Revision: 31076
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 28, 2010 22:08 by Fogh
Initial Code
public class CropText { public CropText() { } public string ShortenText(string input, int MaxLenght, bool DoDots) { string result = input; int InputLength = input.Length; string lastChar = result.Substring(result.Length - 1); if (MaxLenght < InputLength) { result = input.Substring(0, MaxLenght); if (lastChar == " ") { result = result.Substring(0, result.Length - 1); } if (DoDots) { result += "..."; } } return result; } }
Initial URL
Initial Description
Class to shorten text. For example for an article where people can click read more to read the whole article.
Initial Title
Shorten text class
Initial Tags
c, text, aspnet
Initial Language
C#