- CoffeeScript 教程
- CoffeeScript - 主页
- CoffeeScript - 概览
- CoffeeScript - 环境
- CoffeeScript - 命令行实用工具
- CoffeeScript - 语法
- CoffeeScript - 数据类型
- CoffeeScript - 变量
- CoffeeScript - 运算符和别名
- CoffeeScript - 条件语句
- CoffeeScript - 循环
- CoffeeScript - 解析
- CoffeeScript - 函数
- CoffeeScript 面向对象
- CoffeeScript - 字符串
- CoffeeScript - 数组
- CoffeeScript - 对象
- CoffeeScript - 范围
- CoffeeScript - 可变参数
- CoffeeScript - 日期
- CoffeeScript - 数学
- CoffeeScript - 异常处理
- CoffeeScript - 正则表达式
- CoffeeScript - 类和继承
- CoffeeScript 高级
- CoffeeScript - Ajax
- CoffeeScript - jQuery
- CoffeeScript - MongoDB
- CoffeeScript - SQLite
- CoffeeScript 实用资源
- CoffeeScript - 快速指南
- CoffeeScript - 实用资源
- CoffeeScript - 讨论
CoffeeScript 字符串 - toLocaleLowerCase()
说明
此方法用于将字符串中的字符转换为小写,同时考虑当前语言环境。对于大多数语言,它返回与 toLowerCase 相同的输出。
语法
以下是 JavaScript 的 toLocaleLowerCase() 方法语法。我们可以使用相同的 CoffeeScript 代码。
string.toLocaleLowerCase( )
示例
以下示例演示了在 CoffeeScript 代码中使用 JavaScript 的 toLocaleLowerCase() 方法。将此代码保存在一个名为 toLocaleLowerCase.coffee 的文件中
str = "APPLES ARE ROUND AND ORANGES ARE JUCY."; console.log str.toLocaleLowerCase()
打开 命令提示符 并编译 .coffee 文件,如下所示。
c:\> coffee -c coffee toLocaleLowerCase.coffee
编译后,它会生成以下 JavaScript。
// Generated by CoffeeScript 1.10.0
(function() {
var str;
str = "APPLES ARE ROUND AND ORANGES ARE JUCY.";
console.log(str.toLocaleLowerCase());
}).call(this);
现在,再次打开 命令提示符 并运行 CoffeeScript 文件,如下所示。
c:\> coffee toLocaleLowerCase.coffee
执行后,CoffeeScript 文件会生成以下输出。
apples are round and oranges are juicy.
coffeescript_strings.htm
广告