|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
876 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Removes trailing whitespace or specified characters from a string.
|
|---|
| 3 | *
|
|---|
| 4 | * If `chars` is a string, it should be a single character. To trim a string with multiple characters,
|
|---|
| 5 | * provide an array instead.
|
|---|
| 6 | *
|
|---|
| 7 | * @param {string} str - The string from which trailing characters will be trimmed.
|
|---|
| 8 | * @param {string | string[]} chars - The character(s) to remove from the end of the string.
|
|---|
| 9 | * @returns {string} - The resulting string after the specified trailing character has been removed.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * const trimmedStr1 = trimEnd('hello---', '-') // returns 'hello'
|
|---|
| 13 | * const trimmedStr2 = trimEnd('123000', '0') // returns '123'
|
|---|
| 14 | * const trimmedStr3 = trimEnd('abcabcabc', 'c') // returns 'abcabcab'
|
|---|
| 15 | * const trimmedStr4 = trimEnd('trimmedxxx', 'x') // returns 'trimmed'
|
|---|
| 16 | */
|
|---|
| 17 | declare function trimEnd(str: string, chars?: string | string[]): string;
|
|---|
| 18 |
|
|---|
| 19 | export { trimEnd };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.