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

Add comment

biuquote
  • Comment
  • Preview
Loading

Calendar

<<  September 2025  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

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