text-automation
Version:
html转译 富文本单个空格 删除空格
19 lines (17 loc) • 425 B
JavaScript
// 富文本最多显示一个空格
function text_line(line) {
return line.replace(/(\&(nbsp;+|nbsp+))+/g, ' ')
}
// 删除所有空格 中文
function delete_line(line){
var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
if (reg.test(line)) {
return line = line.replace(/\s*/g,"");
} else {
return false
}
}
module.exports ={
text_line,
delete_line
}