如何将我分成小写的单词转换成?我有以下代码。
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

答案 0 :(得分:2)
你可以在JavaScript中做很多事情而不需要自己编写循环。这只是另一个例子。
const title = 'The Quick brown fox';
const words = title.split(' ').map(word => word.toLowerCase());
// print the array
console.log(words);
// print the single words
words.forEach(word => console.log(word));
<强>资源强>
答案 1 :(得分:1)
您只需将Titlewords[i].toLowerCase()
分配回Titlewords[i]
var title = 'The Quick brown fox';
var titleCase = [];
var Titlewords = title.split("");
for (var i = 0; i < Titlewords.length; i++) {
Titlewords[i] = Titlewords[i].toLowerCase();
console.log(Titlewords[i]);
}
&#13;
答案 2 :(得分:0)
您需要更新值
Titlewords[i] = Titlewords[i].toLowerCase();
var title = 'The Quick brown fox';
var titleCase = [];
var Titlewords = title.split("");
for (var i = 0; i < Titlewords.length; i++) {
Titlewords[i] = Titlewords[i].toLowerCase();
console.log(Titlewords[i]);
}
&#13;
答案 3 :(得分:0)
str.toLowerCase()
返回一个字符串,而不是将其设置为更低。你想要做的是
Titlewords[i] = Titlewords[i].toLowerCase();