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'