zoukankan
html css js c++ java
将指定字符串按指定长度进行剪切
/// <summary>
/// 将指定字符串按指定长度进行剪切,
/// </summary>
/// <param name= "oldStr "> 需要截断的字符串 </param>
/// <param name= "maxLength "> 字符串的最大长度 </param>
/// <param name= "endWith "> 超过长度的后缀 </param>
/// <returns> 如果超过长度,返回截断后的新字符串加上后缀,否则,返回原字符串 </returns>
public static string StringTruncat(string oldStr, int maxLength, string endWith)
{
if (string.IsNullOrEmpty(oldStr))
// throw new NullReferenceException( "原字符串不能为空 ");
return oldStr + endWith;
if (maxLength < 1)
throw new Exception("返回的字符串长度必须大于[0] ");
if (oldStr.Length > maxLength)
{
string strTmp = oldStr.Substring(0, maxLength);
if (string.IsNullOrEmpty(endWith))
return strTmp;
else
return strTmp + endWith;
}
return oldStr;
}
查看全文
相关阅读:
iOS客户端的gzip解压
如何将应用打包成.ipa文件(越狱)
手势UIGestureRecognizer
ASIHTTPRequest下载数据
ASIHTTPRequest下载示例(支持断点续传)
ios与android设备即时语音互通的录音格式
删除沙盒中文件夹下所有文件
svn,静态库无法添加
iOS 3D UI——CALayer的transform扩展解析
自定义Tabbar实现push动画隐藏效果
原文地址:https://www.cnblogs.com/colyn/p/2294757.html
最新文章
mysql提供dataprovider
计算机各层含义解释
git与github使用
两种方式testng dataprovider结合csv做测试驱动
httpclient 使用方式介绍
HTML中块级元素与行内元素
Python中的网络编程
使用poi读取xlsx中的数据
wireshark怎么抓包、wireshark抓包详细图文教程
软件质量管理
热门文章
测试缺陷分析务实篇-转
LoadRunner参数值定义-摘自一米阳光
禅道
JMeter基础
查看Linux系统文本编码-方便修改ssh编码一致
LR错误整理
nmon 安装
win7 xp 双系统安装记录
如何在一个应用程序中调用另一个应用程序
Quartz 各种绘制图形用法---实现画图片、写文字、画线、椭圆、矩形、棱形等
Copyright © 2011-2022 走看看