UNPKG

universal-common

Version:

Library that provides useful missing base class library functionality.

40 lines (39 loc) 1.41 kB
/** * A mutable string class that provides an efficient way to build strings. * Similar to StringBuilder in C# or StringBuffer in Java. */ export default class StringBuilder { /** * Creates a new StringBuilder instance. * @param {string} [string] - The initial string value. Default is an empty string. */ constructor(string?: string); /** * Gets the length of the current string. * @returns {number} The number of characters in the current string. */ get length(): number; /** * Appends the string representation of an object to the end of the current string. * @param {*} object - The object to append. * @returns {void} */ append(object: any): void; /** * Appends the string representation of an object followed by a line terminator to the end of the current string. * @param {*} [object] - The object to append. If not provided, only a line terminator is appended. * @returns {void} */ appendLine(object?: any): void; /** * Removes all characters from the current StringBuilder instance. * @returns {void} */ clear(): void; /** * Returns the string representation of the current StringBuilder instance. * @returns {string} The string representation of the current StringBuilder. */ toString(): string; #private; }