首页 新闻 会员 周边

Char.IsLetter的问题

0
[已解决问题] 解决于 2011-02-22 13:04
char a = '';
char b = 'a';
char c = '1';
Console.WriteLine(Char.IsLetter(a));
//输出:True
Console.WriteLine(Char.IsLetter(b));//输出:True
Console.WriteLine(Char.IsLetter(c));//输出:False

Char.IsLetter的方法说明

//
        // 摘要:
        //     指示指定的 Unicode 字符是否属于字母类别。

// Indicates whether the specified Unicode character is categorized as an alphabetic letter.
        //
        // 参数:
        //   c:
        //     一个 Unicode 字符。
        //
        // 返回结果:
        //     如果 c 是字母,则为 true;否则,为 false。

我想问的是 难道"好"是字母?

Firen的主页 Firen | 大侠五级 | 园豆:5385
提问于:2011-02-22 12:41
< >
分享
最佳答案
0

MSDN: "This method determines whether a Char is a member of any category of Unicode letter."

Unicode letter包含但不仅限于英文字母。

还是用正则表达式判断吧。

dudu | 高人七级 |园豆:30994 | 2011-02-22 13:02
其他回答(1)
0

这是个很悲剧的事,当一个char大于0x00ff的时候,他会去取UnicodeCategory……

Gray Zhang | 园豆:17610 (专家六级) | 2011-02-22 13:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册