亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ASP.NET 字符串截取

 更新時間:2009年06月22日 00:52:37   作者:  
兩個截取字符串的實用方法(超過一定長度自動換行)
復(fù)制代碼 代碼如下:

**////
/// 截取字符串,不限制字符串長度
///
/// 待截取的字符串
/// 每行的長度,多于這個長度自動換行
///
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;

}


/**////
/// 截取字符串并限制字符串長度,多于給定的長度+。。。
///
/// 待截取的字符串
/// 每行的長度,多于這個長度自動換行
/// 輸出字符串最大的長度
///
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)文章

最新評論