asp.net中如何截取字符串 规定一定的长度截取字符串? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string s="abcde";string m = s.SubString(1,2);//m=bc String.Substring 方法 (startIndex , length )从此实例检索子字符串。子字符串从指定的字符位置开始且具有指定的长度。startIndex 子字符串的起始位置的索引。 length 子字符串中的字符数。String.Substring 方法 (startIndex ) 从此实例检索子字符串。子字符串从指定的字符位置开始。startIndex 此实例中子字符串的起始字符位置。 在msdn里输入substring就可以查到 String.Substring(startIndex , length ) String.Substring(startIndex , length ) String.Substring(startIndex , length ) String.Substring(startIndex , length ) 还不如自己写几个left,right,mid函数,这样更方便! String.Substring(startIndex , length )同时楼上说的left,right 函数在数据库中是完全可以用的。 eg:select * from yourtable where 时间字段=left(getdate(),9)你系统时间格式要是2004-3-19 00:00:00则取出来的就是2004-3-9 String.Substring(startIndex,length) String.Substring(startIndex) 都是索引值 急急急 报错啊 asp.net中怎么使用事务? ☆★☆★☆★关于access同时增加一条记录到2个表的问题☆★☆★☆★ [100分重赏]ASP.NET网站管理程序怎样从IIS访问? formview控件中的控件取值的问题 请问类似论坛里面的“查看用户名是否存在”按钮怎么做 datagrid显示text字段 请教各高手,在线等待,急!! 事件何时才会触发? 字符串中定义的常量比如说是"asdf",现在假如我还想往值里面添加一个特殊"符号,该怎么办? GridView1_PageIndexChanged 分页里要怎么写? 如何把2002-3-28这样的字符串转换成时间类型?
string m = s.SubString(1,2);
//m=bc
从此实例检索子字符串。子字符串从指定的字符位置开始且具有指定的长度。
startIndex
子字符串的起始位置的索引。
length
子字符串中的字符数。String.Substring 方法 (startIndex )
从此实例检索子字符串。子字符串从指定的字符位置开始。
startIndex
此实例中子字符串的起始字符位置。
同时楼上说的left,right 函数在数据库中是完全可以用的。
select * from yourtable where 时间字段=left(getdate(),9)
你系统时间格式要是2004-3-19 00:00:00
则取出来的就是2004-3-9
String.Substring(startIndex)
都是索引值