camelCase

将字符串转换为驼峰式 (helloWorld)。

camelCase

将字符串转换为驼峰命名格式(第一个单词小写,后续单词首字母大写)。

用法

import { camelCase } from '@movk/core'

camelCase('First Name') // => 'firstName'
camelCase('first_name') // => 'firstName'
camelCase('first-name') // => 'firstName'
camelCase('XMLHttpRequest') // => 'xmlHttpRequest'

API

camelCase(str: string): string

参数

str
string required
要转换的字符串。

返回值

string
返回驼峰式格式的字符串。

Changelog

No recent changes
Copyright © 2024 - 2025 YiXuan - MIT License