首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

将指定字符串按指定长度进展剪切

2012-09-08 
将指定字符串按指定长度进行剪切/// summary /// 将指定字符串按指定长度进行剪切, /// /summary ///

将指定字符串按指定长度进行剪切

/// <summary> /// 将指定字符串按指定长度进行剪切, /// </summary> /// <param name="oldStr "> 需要截断的字符串 /// <param name="maxLength "> 字符串的最大长度 /// <param name="endWith "> 超过长度的后缀 /// <returns> 如果超过长度,返回截断后的新字符串加上后缀,否则,返回原字符串 </returns> public static string StringTruncat(string oldStr, int maxLength, string endWith) { if (string.IsNullOrEmpty(oldStr)) // throw new NullReferenceException( "原字符串不能为空 "); return oldStr; if (maxLength maxLength) { string strTmp = oldStr.Substring(0, maxLength); if (string.IsNullOrEmpty(endWith)) return strTmp; else return strTmp + endWith; } return oldStr; }

?

?

?

?

?

?

?


<a href=" http://s.click.taobao.com/t_3?&p=mm_14877032_0_0&n=23&l=http%3A%2F%2Fsearch8.taobao.com%2Fbrowse%2F50015514%2Fn-

g%2Cmf2wg5djn5xf6y3pnvwws43jn5xf64tborsvwnjqgaxdalbvgaydalrqlu---g%2Czlt4llwo3u-------------8%2C9%2C10%2C11%2C12%2C13%

2C14%2C15%2C16%2C17%2C18%2C19%2C20---40--staticcoefp-0-all-50015514.htm%3Fpid%3Dmm_14877032_0_0">牛仔裤</a>

热点排行