I have a repeater that displays data from my Projects table. There are projectId, name and description. I use Substring(1, 240) on description. But sometimes the string is s
An extension method:
public static string SafeSubstring(this string text, int start, int length) { if (start >= text.Length) return ""; if (start + length > text.Length) length = text.Length - start; return text.Substring(start, length); }