str/capitalize

将字符串第一个字母转换成大写。当lowercaseRest为true时,将除了第一个字母之外的其他字母转换成小写。
Source:
Example
str.capitalize('strjs')                      // 'Strjs'
str.capitalize('STRJS')                      // 'STRJS'

str.capitalize('STRJS', false)               // 'STRJS'
str.capitalize('STRJS', true)                // 'Strjs'

str.capitalize('strJS', false)               // 'StrJS'
str.capitalize('strJS', true)                // 'Strjs'

str.capitalize('strJS is excellent')         // 'StrJS is excellent'
str.capitalize('strJS is excellent', false)  // 'StrJS is excellent'
str.capitalize('strJS is excellent', true)   // 'Strjs is excellent'
Parameters:
Name Type Attributes Default Description
str String 需要转换的字符串
lowercaseRest Boolean <optional>
false 是否将除了第一个字母之外的其他字母转换成小写
Returns:
已转换的字符串
Type
String