Str = "123 4556 66666\n\n\n";
var Str1 = new RegExp('\n', 'g');
Str = Str1.replace(reg1, '');
console.log('替换换行符:'+ Str);
Str = Str.replace(/\s+/g, '');
console.log("去掉空格: " + Str);
微信小程序字符串去掉空格和换行
最新推荐文章于 2024-05-02 14:26:53 发布