lowerFirst()
lowerFirst(
str):string
Converts the first character of a string to lowercase.
note
Supports Unicode characters. Does not modify the rest of the string.
Parametersโ
str: stringโ
The string to convert.
Returns: stringโ
The string with the first character in lowercase.
See Alsoโ
Sinceโ
2.0.0
Also known asโ
lowerFirst (Lodash, es-toolkit) ยท โ (Remeda, Radashi, Ramda, Effect, Modern Dash, Antfu)
Exampleโ
lowerFirst('Hello'); // => 'hello'
lowerFirst('HELLO'); // => 'hELLO'
lowerFirst('รtรฉ'); // => 'รฉtรฉ'
How it works?โ
Converts only the first character to lowercase. Rest of the string is preserved unchanged.
Examplesโ
| Input | Output |
|---|---|
Hello | hello |
HELLO | hELLO |
รtรฉ | รฉtรฉ |
lowerFirst vs capitalizeโ
| Function | 'HELLO' |
|---|---|
lowerFirst | hELLO |
capitalize | Hello |
lowerFirst only changes the first character.
Use Casesโ
Adjust casing ๐โ
Lowercase only the first character. Useful for specific formatting protocols (e.g., XML tags).
const tag = lowerFirst('Div'); // 'div'
Convert class names to instancesโ
Transform PascalCase class names to camelCase variable names.
const varName = lowerFirst('UserService'); // 'userService'