UNPKG

@writ/utils

Version:
12 lines (10 loc) 353 B
const getPunctuationRegex = require('./cn-punctuation-regex'); /** * 清除所有中文字符及空格(中文标点符号) * @param {string} str * @returns {string} */ function clearCNCharsAndSpaces(str) { return str.replace(/[\u4e00-\u9fa5 ]/g, '').replace(getPunctuationRegex(), ''); } module.exports = clearCNCharsAndSpaces;