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) 都是索引值 数据库时间什么时候和系统时间不一致? _________请教各位高手,如图样的自动提示是怎样做的 system.net.mail problem 如何根据叶子节点生成树? 能不能推荐几本书?asp.net(一定要用C#编写) 用datalist怎么生成稍微复杂一点的表 随机后我要如何才能在提交后保持第一次从数据库提取的值呢? SQL语句,这样也行? 请问一个entity framework新增数据的问题 新手问一个datagrid简单问题>? 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)
都是索引值