Skip to main content

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​

upperFirst


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​

InputOutput
Hellohello
HELLOhELLO
Γ‰téétΓ©

lowerFirst vs capitalize​

Function'HELLO'
lowerFirsthELLO
capitalizeHello

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'