Home > @microsoft/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
convertToCrLf(input) static Converts all newlines in the provided string to use Windows-style CRLF end of line characters.
convertToLf(input) static 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.
ensureTrailingNewline(s, newlineKind) static Returns the input string with a trailing \n character appended, if not already present.
padEnd(s, minimumLength, paddingCharacter) static Append characters to the end of a string to ensure the result has a minimum length.
padStart(s, minimumLength, paddingCharacter) static Append characters to the start of a string to ensure the result has a minimum length.
replaceAll(input, searchValue, replaceValue) static Returns the same thing as targetString.replace(searchValue, replaceValue), except that all matches are replaced, rather than just the first match.
truncateWithEllipsis(s, maximumLength) static If the string is longer than maximumLength characters, truncate it to that length using “…” to indicate the truncation.