TypeScript String
14 functions
atstr.at(index: number): string | undefinedReturns the item at the given index (supports negative indices).
replaceAllstr.replaceAll(searchFor, replaceWith): stringReturns a new string with all matches of a pattern replaced.
matchAllstr.matchAll(regexp): IterableIterator<RegExpMatchArray>Returns an iterator of all results matching a string against a regular expression.
trimStartstr.trimStart(): stringRemoves whitespace from the beginning of a string.
trimEndstr.trimEnd(): stringRemoves whitespace from the end of a string.
padStartstr.padStart(targetLength, padString?): stringPads the current string with another string until the resulting string reaches the given length, applied from the start.
padEndstr.padEnd(targetLength, padString?): stringPads the current string with another string until the resulting string reaches the given length, applied from the end.
repeatstr.repeat(count: number): stringReturns a new string which contains the specified number of copies of the string.
startsWithstr.startsWith(searchStr, position?): booleanDetermines whether a string begins with the characters of a specified string.
endsWithstr.endsWith(searchStr, endPosition?): booleanDetermines whether a string ends with the characters of a specified string.
includesstr.includes(searchStr, position?): booleanDetermines whether an array includes a certain value among its entries.
slicestr.slice(start, end?): stringExtracts a section of a string and returns it as a new string.
splitstr.split(separator, limit?): string[]Divides a String into an ordered list of substrings.
template literal`Hello, ${name}!`Embeds expressions within string literals using backtick syntax.
