2024-09-13 10:41:10 +03:00
|
|
|
# trimStart
|
|
|
|
|
|
|
|
Removes leading whitespace or specified characters from a string.
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
function trimStart(str: string, chars?: string | string[]): string;
|
|
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `str` (`string`): The string from which leading characters will be trimmed.
|
2024-09-23 09:13:21 +03:00
|
|
|
- `chars` (`string | string[]`): The character(s) to remove from the start of the string.
|
2024-09-13 10:41:10 +03:00
|
|
|
|
|
|
|
### Returns
|
|
|
|
|
|
|
|
(`string`): The resulting string after the specified leading character has been removed.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
const trimmedStr1 = trimStart('---hello', '-'); // returns 'hello'
|
|
|
|
const trimmedStr2 = trimStart('000123', '0'); // returns '123'
|
|
|
|
const trimmedStr3 = trimStart('abcabcabc', 'a'); // returns 'bcabcabc'
|
|
|
|
const trimmedStr4 = trimStart('xxxtrimmed', 'x'); // returns 'trimmed'
|
|
|
|
```
|