Skip to content

@longmo-utils/common / capitalize

Function: capitalize()

ts
function capitalize(str): string;

将字符串首字母大写

Parameters

ParameterTypeDescription
strstring输入字符串

Returns

string

首字母大写的字符串

Example

ts
capitalize('hello') // 'Hello'
capitalize('hello world') // 'Hello world'

Released under the MIT License.