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
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
14 Methods
Other Private Methods
3 Methods
Properties
Fields
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.