How to

truncate text

Published: 30. January 2012 | Updated: 30. January 2012
License: Microsoft Public License (MS-PL)
Categories: Framework » Strings
Tags: Basics C# Text
Was this snippet helpful for you? YESYES / NONO
public static string Truncate(string value, int length)
{
    return value.Length <= length ? value : value.Substring(0, length);
}
Send us feedback about this snippet »



Related Snippets: