ASP.NET格式转换

来源:互联网 发布:网络本科学位 编辑:程序博客网 时间:2024/05/22 12:51

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型;

1 0
原创粉丝点击