Skip to main content

toUpper()

toUpper(str): string

Converts a string to uppercase.

DEPRECATED

Use string.toUpperCase() directly instead.


Parameters​

str: string | null | undefined​

The string to convert to uppercase.


Returns: string​

The string converted to uppercase.


See Also​


Since​

2.0.0


Also known as​

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


Example​

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

// βœ… Recommended approach
'hello world'.toUpperCase(); // => 'HELLO WORLD'

How it works?​

Converts string to uppercase. Deprecated: Use string.toUpperCase() directly.

Native Equivalent​

// ❌ toUpper('hello')
// βœ… 'hello'.toUpperCase()

Use Cases​

Convert to uppercase πŸ“Œβ€‹

Convert string to uppercase.

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

Format constants​

Format text for display.

const header = title.toUpperCase();