Skip to main content

lowerCase()

lowerCase(str): string

Converts string to lower case with space-separated words.


Parameters​

str: string | null | undefined​

The string to convert.


Returns: string​

The lower cased string with words separated by spaces.


See Also​

String.toLowerCase() - MDN


Since​

2.0.0


Performance​

O(n) β€” charCode word splitting for short ASCII, regex for long/Unicode/emoji.


Also known as​

lowerCase (Lodash, es-toolkit) · ❌ (Remeda, Radashi, Ramda, Effect, Modern Dash, Antfu)


Example​

lowerCase('--Foo-Bar--');  // => 'foo bar'
lowerCase('fooBar'); // => 'foo bar'
lowerCase('__FOO_BAR__'); // => 'foo bar'

How it works?​

Converts string to space-separated lowercase words. Splits on case boundaries, underscores, hyphens, and emojis. Supports Unicode.

Conversion Examples​

InputOutput
'--Foo-Bar--''foo bar'
'fooBar''foo bar'
'__FOO_BAR__''foo bar'
'Γ‘oΓ±oCase''Γ±oΓ±o case'

Process​


Use Cases​

Convert to lower case words πŸ“Œβ€‹

Convert string to space-separated lowercase words. Useful for display labels or normalizing mixed-case input.

lowerCase('fooBar');       // => 'foo bar'
lowerCase('__FOO_BAR__'); // => 'foo bar'
lowerCase('--Foo-Bar--'); // => 'foo bar'

Normalize text for display​

Format programmatic identifiers into human-readable labels.

const label = lowerCase('backgroundColor');
// => 'background color'