The LJCTextBuilder class is designed for creating text. It can also be
used to create HTML and XML text.
The LJCTextBuilder class stores the built text internally. The text is
retrieved with the ToString() method.
Add Text Methods
AddLine(), AddText()
These "Add Text" methods add text to the builder unmodified except for AddLine()
which appends a newline.
Append Text Methods
Line(), Text()
"Append Text" methods add the potentially indented and wrapped text to the
builder.
The Text() method appends the supplied text without an ending newline. This
behavior is done for consistency and it allows for appending to the existing
if desired text.
The "Append Text" methods start the text with a newline if the builder
already has text, param allowNewLine = true (default) and the builder text
does not already end with a newline.
Use the "addIndent" parameter set to "false" when appending text to the
builder that was retrieved using a "Get Text" method. This is because the
indent may already have been added to the text by the "Get Text" method.
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
GetLine(), GetText()
The "Get Text" methods create and return the potentialy indented and
wrapped text but do not add it to the builder.
This allows for using the text outside of the builder.
The GetLine() and GetText() methods modify the returned text the same as
the Line() and Text() methods.
Use the "addIndent" parameter set to "false" when appending text to the
builder that was retrieved using a "Get Text" method. This is because the
indent may already have been added to the text by the "Get Text" method.
Append Element Methods
Begin(), Create(), End()
These methods append element tags and content. Begin() automatically
increments the IndentCount by 1. Create() also increments the IndentCount
by 1 if the isEmpty parameter is false and the close parameter is false.
End() automatically decrements the IndentCount by 1 if the IndentCount
is currently greater than zero.
The "Append Element" methods append the supplied text without an ending
newline. This behavior is done for consistency and it allows for appending
to the existing text if desired.
The "Append Element" methods start the appended text with a newline if the
builder already has text, param allowNewLine = true and builder text does
not already end with a newline.
Get Element Methods
GetBegin(), GetCreate(), GetEnd()
The "Get Element" methods create and return the potentialy indented and
wrapped text but do not add it to the builder.
This allows for using the text outside of the builder.
Use the "addIndent" parameter set to "false" when appending text to the
builder that was retrieved using a "Get Text" method. This is because the
indent may already have been added to the text by the "Get Text" method.
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.