Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道给定一个字符串 str
str.replace(/\s/g,'');
将删除字符串中的所有空格。
如何从字符串中删除所有不是小写字母的字符?
你可以:
str.replace( /[^a-z]/g, '' );