csharp TrimToLength extension method
public static string TrimToLength(this string original, int length) { if (original.Length > length) { original = original.Substring(0, length); } return original; }
Use for trimming a string to a specified length, if it's longer than the length.
Updated: Thursday 19th May 2011, 11:04am
There are 0 comments
Comments are currently closed.