Limit String

by ssi 17. December 2015 10:52
public static string LimitString(string sTextValue, int nMaxLength, string sTextTemplate)
   {
       /********************************************************************
           created:	2014/02/13
           created:	13:2:2014   16:32
           filename: 	C:\Users\Public\Documents\appsCadence\appsGl\GlTran\GLTrans\Classes\clsStaticMethods.cs
           file path:	C:\Users\Public\Documents\appsCadence\appsGl\GlTran\GLTrans\Classes
           file base:	clsStaticMethods
           file ext:	cs
           author:		ssi
           note: 		Usage : LimitString("Ross Mason",25 , "R:{0}$$$")
           purpose:
       *********************************************************************/
       int nLen = Math.Min(string.Format(sTextTemplate, sTextValue).Length, nMaxLength);
       return string.Format(sTextTemplate, sTextValue).Substring(0, nLen);
   }

Tags: ,

CSharp

Calendar

<<  May 2024  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

RecentComments

None

Development Team @ Shelbysys

We develop custom database applications for our clients. Our development tool of choice is MS Visual Studio. 

Quotations

"Courage is fear holding on a minute longer"
General George Patton Jr