c#.net常用函数

1、DateTime   数字型 
       System.DateTime currentTime=new System.DateTime(); 
  1.1 取当前年月日时分秒 
       currentTime=System.DateTime.Now; 
  1.2 取当前年 
       int 年=currentTime.Year; 
  1.3 取当前月 
       int 月=currentTime.Month; 
  1.4 取当前日 
       int 日=currentTime.Day; 
  1.5 取当前时 
       int 时=currentTime.Hour; 
  1.6 取当前分 
       int 分=currentTime.Minute; 
  1.7 取当前秒 
       int 秒=currentTime.Second; 
  1.8 取当前毫秒 
    int 毫秒=currentTime.Millisecond; 

2、  变量.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进制) 
   12345.ToString("p");         //生成 1,234,500.00%

3、char.IsWhiteSpce(字串变量,位数)——逻辑型 
    查指定位置是否空字符; 
    如: 
    string str="中国  人民"; 
    Response.Write(char.IsWhiteSpace(str,2)); //结果为:True, 第一个字符是0位,2是第三个字符。

4、char.IsPunctuation('字符')  --逻辑型 
    查字符是否是标点符号 
   如:Response.Write(char.IsPunctuation('A'));   //返回:False 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值