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

<<  July 2025  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

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

"The distance between insanity and genius is measured only by success."
Bruce Feirstein