代码:

function trim(str) {
    if (str && typeof str === "string") {
        return str.replace(/(^\s*)|(\s*)$/g,""); //去除前后空白符
    }
}

.

相关文章:

  • 2022-12-23
  • 2022-03-10
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2021-11-04
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案