题解 | #去除字符串两端空格#
去除字符串两端空格
https://www.nowcoder.com/practice/beb16fb3a8da49939ffff388e7c3e304
function _trim(string) { //两端可能不止一个空格 return string.replace(/^\s+|\s+$/g, ""); }
去除字符串两端空格
https://www.nowcoder.com/practice/beb16fb3a8da49939ffff388e7c3e304
function _trim(string) { //两端可能不止一个空格 return string.replace(/^\s+|\s+$/g, ""); }
相关推荐