跳到主要内容
主动阅读[<https://en.wikipedia.org/wiki/%22你好,_World!%22_程序>]。
来源 链接
彼得·莫特森
  • 31.6万
  • 22
  • 109
  • 132

一个小小的改进——标题中的每个单词。

String.prototype.toTitleCase=函数(){return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()});}var s='你好, wOrLD';“哦!”;console.log(s.toTitleCase());//你好,世界!

一个小小的改进——标题中的每个单词。

String.prototype.toTitleCase=函数(){return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()});}var s='你好wOrLD';console.log(s.toTitleCase());//你好,世界

一个小小的改进——标题中的每个单词。

String.prototype.toTitleCase=函数(){return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()});}var s=“你好”, 哇!';console.log(s.toTitleCase());//你好,世界!
改进的格式
来源 链接
威廉·伊斯特德
  • 12.2公里
  • 4
  • 32
  • 46
一个小小的改进——标题中的每个单词。

一个小小的改进——标题中的每个单词。

 String.prototype.toTitleCase=函数(){  return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()});}var s='你好wOrLD(沃尔德)'wOrLD';console.log(s.toTitleCase());//你好,世界 
一个小小的改进——标题中的每个单词。
 String.prototype.toTitleCase=函数(){return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()})}var s='你好wOrLD(沃尔德)'console.log(s.toTitleCase())//你好世界 

一个小小的改进——标题中的每个单词。

String.prototype.toTitleCase=函数(){  return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()});}var s='你好wOrLD';console.log(s.toTitleCase());//你好,世界
在正文中添加了4个字符
来源 链接
一个小小的改进——标题中的每个单词。


    字符串原型。标题酶到TitleCase=函数(){    return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()})    }    
    var s='helLLo wOrLD'    console.log(s。标题酶到TitleCase()//你好世界
一个小小的改进——标题中的每个单词。


    字符串原型。标题酶=函数(){    return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()})    }    
    var s='helLLo wOrLD'    控制台日志。标题酶()//你好世界
一个小小的改进——标题中的每个单词。
字符串原型。到TitleCase=函数(){return this.replace(/\b(\w+)/g,函数(m,p){return p[0].toUpperCase()+p.substr(1).toLowerCase(()})}var s='helLLo wOrLD'console.log(s。至标题案例()//你好世界
正文中添加了154个字符
来源 链接
加载
来源 链接
加载