tp.StringBuilder
tp.StringBuilder is a small helper class for constructing text step by step.
It keeps an internal string, appends values, appends line breaks, inserts text, replaces text,
and clears the result. It is useful in code that generates reports, diagnostic text, HTML snippets,
SQL-like text, or any multi-line output.
JavaScript strings are immutable, so every concatenation creates a new string. This class does not try to be a complex buffer implementation. Its value is readability: code that builds text becomes clear and explicit, especially when many lines are involved.
Interactive builder
Type a string and add it to the builder. Every click writes the current builder contents to the log, so the change is visible immediately.
Append text
Append() adds text without a line break.
AppendLine() adds optional text and then the builder line break.
Edit text
Insert() inserts text at an index. Replace() replaces
all occurrences and may work case-insensitively.
State
Length, IsEmpty, and LineBreak expose the
current builder state. Clear() resets the internal string.
Current result
ToString() and toString() both return the built text.
The preview below displays the current value.