The toLocaleLowerCase()
method returns the calling string value converted to lower case, according to any locale-specific case mappings.
String.prototype.toLocaleLowerCase()
Try it
Syntax
toLocaleLowerCase() toLocaleLowerCase(locale) toLocaleLowerCase([locale1, locale2, ...])
Parameters
-
locale
Optional -
The
locale
parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings. If multiple locales are given in anArray
, the best available locale is used. The default locale is the host environment's current locale.
Return value
A new string representing the calling string converted to lower case, according to any locale-specific case mappings.
Exceptions
- A
RangeError
("invalid language tag: xx_yy") is thrown if alocale
argument isn't a valid language tag. - A
TypeError
("invalid element in locales argument") is thrown if an array element isn't of type string.
Description
The toLocaleLowerCase()
method returns the value of the string converted to lower case according to any locale-specific case mappings. toLocaleLowerCase()
does not affect the value of the string itself. In most cases, this will produce the same result as toLowerCase()
, but for some locales, such as Turkish, whose case mappings do not follow the default case mappings in Unicode, there may be a different result.
Examples
Using toLocaleLowerCase()
'ALPHABET'.toLocaleLowerCase(); // 'alphabet' '\u0130'.toLocaleLowerCase('tr') === 'i'; // true '\u0130'.toLocaleLowerCase('en-US') === 'i'; // false let locales = ['tr', 'TR', 'tr-TR', 'tr-u-co-search', 'tr-x-turkish']; '\u0130'.toLocaleLowerCase(locales) === 'i'; // true
Specifications
Specification |
---|
ECMAScript Language Specification # sec-string.prototype.tolocalelowercase |
ECMAScript Internationalization API Specification # sup-string.prototype.tolocalelowercase |
Browser compatibility
Desktop | Mobile | Server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | Deno | Node.js | |
toLocaleLowerCase |
1
|
12
|
1
|
5.5
|
4
|
1.3
|
1
|
18
|
4
|
10.1
|
1
|
1.0
|
1.0
|
0.10.0
|
locale |
58
|
12
|
55
|
6
|
45
|
10
|
58
|
58
|
55
|
43
|
10
|
7.0
|
1.8
1.0-1.8
Only the locale data for
en-US is available.
|
13.0.0
0.12.0
Before version 13.0.0, only the locale data for
en-US is available by default. When other locales are specified, the function silently falls back to
en-US . To make full ICU (locale) data available before version 13, see
Node.js documentation on the --with-intl option and how to provide the data.
|
See also
© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase