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, 12:36am

There are 0 comments

Leave a comment of your own

Comments are currently closed.