首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

string.toLocaleLowerCase

toLocaleLowerCase()方法根据任何特定于语言环境的案例映射,返回调用字符串值转换为小写的值。

语法

代码语言:javascript
复制
str.toLocaleLowerCase()
str.toLocaleLowerCase(locale) 
str.toLocaleLowerCase([locale, locale, ...])

参数

locale可选,locale参数指示根据任何语言环境特定的大小写映射转换为小写的语言环境。如果有多个语言环境在给定的Array,在最好的语言环境中使用。默认语言环境是主机环境的当前语言环境。

返回值

根据任何特定于语言环境的案例映射,将表示调用字符串的新字符串转换为小写。

异常

  • RangeError(“无效的语言标签:xx_yy”)如locale参数不是一个有效的语言标记。
  • TypeError ("“无效的元素标签:xx_yy”") i如果array不是字符串类型

描述

toLocaleLowerCase()方法返回调用该方法的字符串被转换成小写之后的值,转换规则根据任何本地化特定的大小写映射toLocaleLowerCase()并不会影响字符串自身的值。在大多数情况下,该方法产生的结果和调用toLowerCase()的结果相同,但是在某些本地环境中,比如土耳其语,它的大小写映射并不遵循在Unicode中的默认的大小写映射,因此会有一个不同的结果。

示例

使用 toLocaleLowerCase()

代码语言:javascript
复制
'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

规范

Specification

Status

Comment

ECMAScript 3rd Edition (ECMA-262)

Standard

Initial definition. Implemented in JavaScript 1.2.

ECMAScript 5.1 (ECMA-262)The definition of 'String.prototype.toLocaleLowerCase' in that specification.

Standard

ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'String.prototype.toLocaleLowerCase' in that specification.

Standard

ECMAScript Latest Draft (ECMA-262)The definition of 'String.prototype.toLocaleLowerCase' in that specification.

Living Standard

ECMAScript Internationalization API 4.0 (ECMA-402)The definition of 'String.prototype.toLocaleLowerCase' in that specification.

Draft

ES Intl 2017 added the locale parameter.

浏览器兼容性

Feature

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

locale

?

?

55

?

?

?

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

locale

?

?

?

55

?

?

?

扫码关注腾讯云开发者

领取腾讯云代金券