# string

字符串操作工具函数

## Functions

### camelize

中划线转小驼峰

```ts
function camelize(str: string): string
```

**Example**

```ts
camelize('user-info')  // 'userInfo'
camelize('hello-world-test') // 'helloWorldTest'
```

### kebabCase

驼峰转中划线

```ts
function kebabCase(str: string): string
```

**Example**

```ts
kebabCase('userInfo')  // 'user-info'
kebabCase('helloWorldTest') // 'hello-world-test'
```

### snakeCase

驼峰转下划线

```ts
function snakeCase(str: string): string
```

**Example**

```ts
snakeCase('userInfo')  // 'user_info'
snakeCase('helloWorldTest') // 'hello_world_test'
```

### lowerFirst

首字母转小写

```ts
function lowerFirst(str: string): string
```

**Example**

```ts
lowerFirst('UserInfo')  // 'userInfo'
lowerFirst('Hello') // 'hello'
```

### upperFirst

首字母转大写

```ts
function upperFirst(str: string): string
```

**Example**

```ts
upperFirst('userInfo')  // 'UserInfo'
upperFirst('hello') // 'Hello'
```

### trim

去除字符串首尾空白

```ts
function trim(str: string, chars?: string): string
```

**Example**

```ts
trim('  hello  ') // 'hello'
trim('--hello--', '-') // 'hello'
```

### repeat

重复字符串

```ts
function repeat(str: string, count: number): string
```

**Example**

```ts
repeat('a', 3) // 'aaa'
repeat('ab', 2) // 'abab'
```

### padStart / padEnd

字符串补全

```ts
function padStart(str: string, length: number, chars?: string): string
function padEnd(str: string, length: number, chars?: string): string
```

**Example**

```ts
padStart('5', 2, '0') // '05'
padEnd('hi', 4, '!') // 'hi!!'
```
