更新时间:2023-02-05 13:45:38
你不需要jQuery。您可以使用Javascript 字符串
和数组
函数。
You don't need jQuery for this. You can use Javascript string
and array
functions.
分割字符串。
,分隔不同的句子加入。
.
, to separate different sentences.
var str = 'this is a test. this is one more test. and this also new test.';
var newStr = str.split('.').map(function(el) {
el = el.trim();
return el.substr(0, 1).toUpperCase() + el.substr(1);
}).join('. ');
alert(newStr.trim());