A utility class to word-wrap and indent blocks of text.
static string RightString(string str, int n)
Return the right part of a string in a way that compensates for Substring's deficiencies.
TextWrapper(string input)
static string LeftString(string str, int n)
Return the left part of a string in a way that compensates for Substring's deficiencies.
static List< StringBuilder > AddWordToLastLineOrCreateNewLineIfNecessary(List< StringBuilder > lines, string word, int columnWidth)
When presented with a word, either append to the last line in the list or start a new line.
string ToText()
Returns the current state of the TextWrapper as a string.
TextWrapper Indent(int numberOfSpaces)
Indent all lines in the TextWrapper by the desired number of spaces.
static string WrapAndIndentText(string input, int indentLevel, int columnWidth)
Convenience method to wraps and indent a string in a single operation.
string[] WordWrapLine(string line, int columnWidth)
TextWrapper WordWrap(int columnWidth)
Splits a string into a words and performs wrapping while also preserving line-breaks and sub-indentat...