Aller au contenu principal

toLower()

toLower(str): string

Converts a string to lowercase.

DEPRECATED

Use string.toLowerCase() directly instead.


Parameters

str: string | null | undefined

The string to convert to lowercase.


Returns: string

The string converted to lowercase.


See Also


Since

2.0.0


Also known as

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


Example

// ❌ Deprecated approach
toLower('HELLO WORLD'); // => 'hello world'

// ✅ Recommended approach
'HELLO WORLD'.toLowerCase(); // => 'hello world'

How it works?

Converts string to lowercase. Deprecated: Use string.toLowerCase() directly.

Native Equivalent

// ❌ toLower('HELLO')
// ✅ 'HELLO'.toLowerCase()

Use Cases

Convert to lowercase 📌

Convert string to lowercase.

'HELLO'.toLowerCase();  // 'hello'

Normalize for comparison

Case-insensitive string comparison.

const matches = input.toLowerCase() === expected.toLowerCase();