欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ASP.NET兩個(gè)截取字符串的方法分享

 更新時(shí)間:2013年11月08日 16:32:02   作者:  
這篇文章介紹了ASP.NET兩個(gè)截取字符串的方法,有需要的朋友可以參考一下

復(fù)制代碼 代碼如下:

兩個(gè)截取字符串的實(shí)用方法(超過(guò)一定長(zhǎng)度自動(dòng)換行)
///
 /// 截取字符串,不限制字符串長(zhǎng)度
 ///
 /// 待截取的字符串
 /// 每行的長(zhǎng)度,多于這個(gè)長(zhǎng)度自動(dòng)換行
 ///
 public string CutStr(string str,int len)
 { string s="";

 for(int i=0;i 11 {
 int r= i% len;
 int last =(str.Length/len)*len;
 if (i!=0 && i<=last)
 {

 if( r==0)
 {
 s+=str.Substring(i-len,len)+"";
 }

 }
 else if (i>last)
 {
 s+=str.Substring(i-1) ;
 break;
 }

 }

 return s;

 }


 ///
 /// 截取字符串并限制字符串長(zhǎng)度,多于給定的長(zhǎng)度+。。。
 ///
 /// 待截取的字符串
 /// 每行的長(zhǎng)度,多于這個(gè)長(zhǎng)度自動(dòng)換行
 /// 輸出字符串最大的長(zhǎng)度
 ///
 public string CutStr(string str,int len,int max)
 {
 string s="";
 string sheng="";
 if (str.Length >max)
 {
 str=str.Substring(0,max) ;
 sheng="";
 }
 for(int i=0;i 53 {
 int r= i% len;
 int last =(str.Length/len)*len;
 if (i!=0 && i<=last)
 {

 if( r==0)
 {
 s+=str.Substring(i-len,len)+"";
 }

 }
 else if (i>last)
 {
 s+=str.Substring(i-1) ;
 break;
 }

 }

 return s+sheng;

 }

相關(guān)文章

最新評(píng)論