|
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:
887 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Removes leading 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 leading characters will be trimmed.
|
|---|
| 8 | * @param {string | string[]} chars - The character(s) to remove from the start of the string.
|
|---|
| 9 | * @returns {string} - The resulting string after the specified leading character has been removed.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * const trimmedStr1 = trimStart('---hello', '-') // returns 'hello'
|
|---|
| 13 | * const trimmedStr2 = trimStart('000123', '0') // returns '123'
|
|---|
| 14 | * const trimmedStr3 = trimStart('abcabcabc', 'a') // returns 'bcabcabc'
|
|---|
| 15 | * const trimmedStr4 = trimStart('xxxtrimmed', 'x') // returns 'trimmed'
|
|---|
| 16 | */
|
|---|
| 17 | declare function trimStart(str: string, chars?: string | string[]): string;
|
|---|
| 18 |
|
|---|
| 19 | export { trimStart };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.