ASP.NET格式转换

1.int str_a=”33”

int  i_a=Convert.ToInt16(str_a);转换为短整型(16)

2.charchar_a;

char_a=Convert.ToChar(65);

Response.Write(char_a); 将SCII码表的65转成字符;

结果为A

1.      char_a; char_a=”hello world”.ToCharArray();将字符串转为字符型数组

2.     自动转换类型;int age=10;  Response.Write(“今年我”+age+”岁”);整型或其他类型,与字符串型加在一起,自动转为字符串型;或者另一种写法:Response.Write(“今年我”+age.ToString()+”岁”);

3.     Numb_fen=double.Parse(textbox_1.Text);

Lable_1.Text=Numb_fen; 

Lable.ForceColor=System.Drawing.Color.Green;标签前景色为绿色;

将文本框的文字转化为double型;

发布了19 篇原创文章 · 获赞 16 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/wmin510/article/details/51447780
今日推荐