/ Assembly List / LJCNetCommon / TextBuilder

Namespace - LJCNetCommon


Syntax

C#
public class TextBuilder

Provides methods for creating text.

Remarks

The TextBuilder class is designed for creating text. It is similar in principle to the StringBuilder class which is designed for creating strings.

The TextBuilder class - like the StringBuilder class - stores the text internally. The text is retrieved with the ToString() method.

Add Text Methods
The "Add" methods are similar to StringBuilder methods:
AddLine() - StringBuilder.AppendLine()
AddText() - StringBuilder.Append()
"Add" methods add text to the builder unmodified except for AddLine() which appends a newline.

Append Text Methods
Item(), Line(), Text()
"Append" methods add the potentially indented and wrapped text to the builder.
The Text() method creates the added text without an ending newline This behavior is done for consistency and it allows the developer to append to the existing text.
"Append" methods start the text with a newline if the builder already has text, param allowNewLine = true and builder text does not end with a newline.
The Line() and Text() methods should have the addIndent property set to false if it applies text retrieved with a "Get" method as the "Get" method has already applied the indent.

The AddIndent() method manually controls the current indent count. The indent string length is calculated with the properties (IndentCount * IndentCharCount) and can be retrieved with the IndentLength property.

Get Text Methods
GetItem(), GetLine(), GetText()
All "Get" methods create and return the potentialy indented and wrapped text but do not add it to the builder.

Constructor
#ctor Initializes an object instance.

Data
ToString Retrieves the text.

Methods
AddIndent Changes the IndentCount by the provided value.

Append Text
AddLine Adds a text line without modification.
AddText Adds text without modification.
Item Adds a delimiter if not the first list item and adds a newline if line length is greater than
Line Adds a modified text line to the builder.
Text Adds modified text to the builder.

Get Text
GetLine Gets a modified text line.
GetText Gets potentially indented and wrapped text.
GetIndented Gets a new potentially indented line.
GetIndentString Returns the current indent string.
GetWrapped Gets added text and new wrapped line if combined line > LineLimit.

Other Public Methods
Clear Clears the Builder text.
EndsWithNewLine Indicates if the builder text ends with a newline.
14 Methods

Other Private Methods
GetDelimited Missing Summary
StartWithNewLine Allow text to start with a newline.
3 Methods

Properties
Builder The internal StringBuilder class.
Delimiter Gets or sets the delimiter.
HasText Indicates if the builder has text.
IndentCharCount Gets or sets the indent character count.
IndentCount Gets the indent count.
IndentLength Gets the current indent length.
IsFirst Gets or sets the first item indicator.
LineLength Gets the current length.
LineLimit Gets or sets the character limit.
WrapAtDelimiter Indicates that a wrap should occur at a leading delimiter.
WrapEnabled Indicates if line wrapping is enabled.
WrapPrefix Gets or sets the new line prefix.

Fields
DebugText Missing Summary

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.