跳到主要内容
2024年开发商调查到此,我们希望听到您的意见! 参加2024年开发商调查
主动阅读[<https://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>]。松开。在英语中,单数第一人称代词“I”的主观性形式是大写的。
来源 链接
彼得·莫特森
  • 31.3万
  • 22
  • 109
  • 132

我也试着这么做找到了一个更短的方法 :

函数格式字符串(str){返回str  .替换(/(\B)[^]*/g, 匹配=> (match.toLowerCase())  .替换(/^[^]/g,匹配=>匹配=>(与UpperCase()匹配);}var text=“aaa BBB CCC”;console.log(formatString(文本));

我也试着这么做找到了一个更短的方法 :

函数格式字符串(str){返回str.replace(/(\B)[^]*/g,match=>(match.toLowerCase())).替换(/^[^]/g,匹配=>(与UpperCase()匹配);}var text=“aaa BBB CCC”;console.log(formatString(文本));

我也试着这么做找到了一种更短的方法:

函数格式字符串(str){返回str  .替换(/(\B)[^]*/g, 匹配=> (与LowerCase()匹配)  .替换(/^[^]/g,匹配=>(与UpperCase()匹配);}var text=“aaa BBB CCC”;console.log(formatString(文本));

来源 链接
G.库尔蒙特
  • 187
  • 11

我也在尝试这样做,我找到了一个更短的方法:

函数格式字符串(str){返回str.replace(/(\B)[^]*/g,match=>(match.toLowerCase())).replace(/^[^]/g,match=>(match.toUpperCase()));}var text=“aaa BBB CCC”;console.log(formatString(文本));