/* 常数字段 */
maxvalue //65535
minvalue //0
/* 静态方法 */
char.convertfromutf32() //转 unicode 值到字符串
char.converttoutf32() //转到 unicode 值
char.equals() //=
char.getnumericvalue() //数字字符转换成相应的值, 返回类型是 double
char.getunicodecategory() //获取字符类别
char.iscontrol() //?控制字符
char.isdigit() //?十进制数字(0..9)
char.ishighsurrogate() //?高代理项码位(u+d800...u+dbff)
char.isletter() //?字母
char.isletterordigit() //?字母或十进制数字?
char.islower() //?小写字母(a..z 等)
char.islowsurrogate() //?高代理项码位(u+dc00...u+dfff)
char.isnumber() //?数字(0..9 等)
char.ispunctuation() //?标点符号?
char.isseparator() //?分隔符(空格等)
char.issurrogate() //?代理项码位
char.issurrogatepair() //判断两个 char 对象是否形成代理项对
char.issymbol() //?符号($ + = < > ^ ` | 等)
char.isupper() //?大写字母(a..z 等)
char.iswhitespace() //?空白
char.parse() //转换单字符的 string 到 char
char.tolower() //转小写
char.tolowerinvariant() //转小写, 使用区域性规则
char.tostring() //
char.toupper() //转大写
char.toupperinvariant() //转大写, 使用区域性规则
char.tryparse() //尝试转换单字符的 string 到 char
/* 对象方法 */
compareto() //对比, 返回表示距离的整数
--------------------------------------------------------------------------------
getnumericvalue():
--------------------------------------------------------------------------------
protected void button1_click(object sender, eventargs e)
{
double f1 = char.getnumericvalue('9'); // 9
double f2 = char.getnumericvalue('a'); //-1
double f3 = char.getnumericvalue('万'); //-1double f4 = char.getnumericvalue("a1b2", 3); // 2
textbox1.text = string.concat(f1, "n", f2, "n", f3, "n", f4);
}--------------------------------------------------------------------------------
convertfromutf32()、converttoutf32():
--------------------------------------------------------------------------------
protected void button1_click(object sender, eventargs e)
{
string s1 = char.convertfromutf32(65); //a
string s2 = char.convertfromutf32(0x4e07); //万int n1 = char.converttoutf32("abc", 1); //66
int n2 = char.converttoutf32("万", 0); //19975textbox1.text = string.concat(s1, "n", s2, "n", n1, "n", n2);
}--------------------------------------------------------------------------------
getunicodecategory():
--------------------------------------------------------------------------------
protected void button1_click(object sender, eventargs e)
{
char c;
string str = "";
for (int i = 20; i < 256; i++)
{
c = convert.tochar(i);
str += string.format("{0}t{1}t{2}n", i, c, char.getunicodecategory(c));
}
textbox1.text = str;
}