1.datetime 数字型
1.1 取当前年月日时分秒 【程序编程相关:如何在DAS中实现快照复制和克隆备份?】system.datetime currenttime=new system.datetime(); 【推荐阅读:DASD是什么?】1.2 取当前年 【扩展信息:NAS和DAS的不同之处在哪里?】currenttime=system.datetime.now; 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.int32.parse(变量) int32.parse("常量")
字符型转换 转为32位数字型3. 变量.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% 4.变量.length 数字型 取字串长度: 如: string str="中国"; int len = str.length ; //len是自定义变量, str是求测的字串的变量名5.system.text.encoding.default.getbytes(变量)
字码转换 转为比特码 如:byte[] bytstr = system.text.encoding.default.getbytes(str); 然后可得到比特长度: len = bytstr.length;6.system.text.stringbuilder("")
字符串相加,(+号是不是也一样?) 如:system.text.stringbuilder sb = new system.text.stringbuilder(""); sb.append("中华"); sb.append("人民"); sb.append("共与国");7.变量.substring(参数1,参数2);
截取字串的一部分,参数1为左起始位数,参数2为截取几位. 如:string s1 = str.substring(0,2);8.string user_ip=request.servervariables["remote_addr"].tostring();
取远程用户ip地址 ... 下一页