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'