Skip to content

camelCase() function

str 转换为驼峰命名。根据空格、标点、数字、大小写边界和缩写词拆分单词。

Signature:

typescript
function camelCase(str: string): string;

Example

ts
camelCase("foo bar"); // "fooBar"
camelCase("foo-bar"); // "fooBar"
camelCase("foo_bar"); // "fooBar"
camelCase("FooBar"); // "fooBar"
camelCase("XMLHttpRequest"); // "xmlHttpRequest"

Open Source Code

Released under the Apache-2.0 License.