String.prototype.toLocaleLowerCase()
String 值的 toLocaleLowerCase() 方法返回根据任何特定于区域设置的大小写映射转换为小写的字符串。
¥The toLocaleLowerCase() method of String values returns this string converted to lower case, according to any locale-specific case mappings.
Try it
语法
参数
¥Parameters
localesOptional-
带有 BCP 47 语言标记的字符串,或此类字符串的数组。指示根据任何特定于区域设置的大小写映射用于转换为小写的区域设置。有关
locales论证的一般形式和解释,请参阅Intl主页参数说明。与使用
locales参数的其他方法不同,toLocaleLowerCase()不允许区域设置匹配。因此,在检查locales参数的有效性后,toLocaleLowerCase()始终使用列表中的第一个区域设置(如果列表为空,则使用默认区域设置),即使实现不支持此区域设置。
返回值
描述
¥Description
toLocaleLowerCase() 方法返回根据任何特定于区域设置的大小写映射转换为小写的字符串值。toLocaleLowerCase() 不影响字符串本身的值。在大多数情况下,这将产生与 toLowerCase() 相同的结果,但对于某些区域设置(例如土耳其语),其大小写映射不遵循 Unicode 中的默认大小写映射,可能会产生不同的结果。
¥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.
示例
使用 toLocaleLowerCase()
¥Using toLocaleLowerCase()
"ALPHABET".toLocaleLowerCase(); // 'alphabet'
"\u0130".toLocaleLowerCase("tr") === "i"; // true
"\u0130".toLocaleLowerCase("en-US") === "i"; // false
const locales = ["tr", "TR", "tr-TR", "tr-u-co-search", "tr-x-turkish"];
"\u0130".toLocaleLowerCase(locales) === "i"; // true
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-string.prototype.tolocalelowercase |
| ECMAScript Internationalization API Specification # sup-string.prototype.tolocalelowercase |
浏览器兼容性
BCD tables only load in the browser