Home > @rushstack/node-core-library > Text
Text class
Operations for working with strings that contain text.
Signature:
export declare class Text
Remarks
The utilities provided by this class are intended to be simple, small, and very broadly applicable.
Methods
Method | Modifiers | Description |
|---|---|---|
| Converts all newlines in the provided string to use the specified newline type. | |
| Converts all newlines in the provided string to use Windows-style CRLF end of line characters. | |
| Converts all newlines in the provided string to use POSIX-style LF end of line characters. POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc. | |
| Returns the input string with a trailing | |
| Escapes a string so that it can be treated as a literal string when used in a regular expression. | |
| Returns the newline character sequence for the specified | |
| Append characters to the end of a string to ensure the result has a minimum length. | |
| Append characters to the start of a string to ensure the result has a minimum length. | |
| Read lines from an iterable object that returns strings or buffers, and return a generator that produces the lines as strings. The lines will not include the newline characters. | |
| Read lines from an iterable object that returns strings or buffers, and return a generator that produces the lines as strings. The lines will not include the newline characters. | |
| Returns the same thing as targetString.replace(searchValue, replaceValue), except that all matches are replaced, rather than just the first match. | |
| Returns a new string that is the input string with the order of characters reversed. | |
| Splits the provided string by newlines. Note that leading and trailing newlines will produce leading or trailing empty string array entries. | |
| ||
| ||
| If the string is longer than maximumLength characters, truncate it to that length using "..." to indicate the truncation. |