Skip to content

capitalize() function

str 的第一个字符转换为大写,其余字符转换为小写。

Signature:

typescript
function capitalize(str: string): string;

Example

ts
capitalize("fred"); // "Fred"
capitalize("FRED"); // "Fred"
capitalize(""); // ""

Open Source Code

Released under the Apache-2.0 License.