.net 文字调用文字限制
2012-03-14 10:06
99 查看
调用文字字符限制:
前台调用:
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; }
前台调用:
<%# StringTruncat(Eval("PinPaiPingJia").ToString(), 100, "...")%>
相关文章推荐
- .Net 如何模拟会话级别的信号量,对http接口调用频率进行限制(有demo)
- .Net 如何模拟会话级别的信号量,对http接口调用频率进行限制(有demo)
- 【转】C#多线程环境下调用 HttpWebRequest 并发连接限制 HttpClient是否有默认并发数限制? 在.Net 4.0之前,一直是依靠HttpWebRequest实现Htt
- 用.NET调用Oracle存储过程返回记录集
- .Net 异步调用
- 疯狂.NET 通用权限设计 C\S后台管理,B\S前台调用源码样例程序源码下载之 --- 操作权限
- .NET同页面内用户控件与父页面以及控件之间方法调用
- 巧用C#做中间语言 实现Java调用.net DLL的方法
- .NET 2.0 OCR文字识别技术(Tesseract 引擎)
- .net 下用javascript调用webservice
- .NET中如何在调用COM时得到返回参数值System.Type.InvokeMember的使用
- InstallShield调用.net的dll实现des加密功能
- .net ADF 中 Ajax 的调用过程.
- 怎么用html 显示出一横的多出来的文字,怎么实现CSS限制字数,超出部份显示点点点.
- axis,axis2调用.net的webservice
- .NET中统一的存储过程调用方法
- 从COM组件调用.NET组件编程实战
- java调用.net webservice的完整实例
- .net调用c++ dll
- .net写加密的com组件给ASP,VB,VC等其他语言调用