lowerFirst
首字母转为小写,其余字符保持不变
引入版本
0.40.0
Demo
ts
import { lowerFirst } from '@wyfex/iutils'
// 常规大写开头字符串
console.log(lowerFirst('Hello')) // hello
console.log(lowerFirst('Vue')) // vue
console.log(lowerFirst('Batch')) // batch
// 单字符
console.log(lowerFirst('A')) // a
console.log(lowerFirst('7')) // 7
console.log(lowerFirst('#')) // #
// 空字符串
console.log(lowerFirst('')) // ""
// 首字符非字母
console.log(lowerFirst('99Test')) // 99Test
console.log(lowerFirst(' _Demo')) // _Demo
// 原首字母已小写
console.log(lowerFirst('hello')) // hello
// 混合大小写
console.log(lowerFirst('HElloWorld')) // hElloWorld
// 非法/非字符串入参兼容
console.log(lowerFirst(null)) // ""
console.log(lowerFirst(undefined)) // ""
console.log(lowerFirst(123)) // 123
console.log(lowerFirst(true)) // true
console.log(lowerFirst(false)) // false
console.log(lowerFirst({})) // [object Object]