public static string RichTextSubString(this string text, int length) { var m = new RichTextSubStringMaker(text); for (int i = 0; i < length; i++) { m.Consume(); } return(m.GetRichText()); }
public static int RichTextLength(this string text) { var m = new RichTextSubStringMaker(text); var length = 0; while (m.IsConsumable()) { if (m.Consume()) { length += 1; } } return(length); }