
ASP.Net技术文章
zhf97421
这个作者很懒,什么都没留下…
展开
-
截取字串的一部分
变量.Substring(参数1,参数2); 截取字串的一部分,参数1为左起始位数,参数2为截取几位。 如:string s1 = str.Substring(0,2);原创 2005-12-06 10:03:00 · 817 阅读 · 0 评论 -
清除前后的空格
Trim() 清除字串前后空格原创 2005-12-06 10:05:00 · 632 阅读 · 0 评论 -
替换字符
字串变量.Replace("子字串","替换为") 字串替换 如: string str="中国"; str=str.Replace("国","央"); //将国字换为央字 Response.Write(str); //输出结果为“中央”原创 2005-12-06 10:06:00 · 655 阅读 · 0 评论 -
取最大值
Math.Max(i,j) 取i与j中的最大值 如 int x=Math.Max(5,10);原创 2005-12-06 10:10:00 · 777 阅读 · 0 评论 -
ToString()的格式
字符型转换 转为字符串 12345.ToString("n"); //生成 12,345.00 12345.ToString("C"); //生成 ¥12,345.00 12345.ToString("e"); //生成 1.234500e+004 12345.ToString("f4"); //生成 12345.0000 12345.ToString("x"); //生成 3039 (16进制)原创 2005-12-06 09:58:00 · 742 阅读 · 0 评论 -
字符串长度
取字串长度: 如: string str="中国"; int Len = str.Length ; //Len是自定义变量, str是求测的字串的变量名原创 2005-12-06 09:59:00 · 688 阅读 · 0 评论 -
DateTime数字类型格式
1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; int 年=currentTime.Year; int 月=currentTime.Month; int 日=currentTime.Day; int 时=currentTi原创 2005-12-06 09:55:00 · 981 阅读 · 0 评论 -
字符型转为32位数字型
Int32.Parse(变量) Int32.Parse("常量")原创 2005-12-06 09:57:00 · 1017 阅读 · 0 评论