js去除文本空格

方法一:使用replace正則匹配的方法 去除全部空格: str = str.replace(/\s*/g,」「); web 去除兩頭空格: str = str.replace(/^\s*|\s*$/g,」「);ruby 去除左空格: str = str.replace( /^\s*/, 「」);svg 去除右空格: str = str.replace(/(\s*$)/g, 「」);spa str
相關文章
相關標籤/搜索