For the complete documentation index, see llms.txt. This page is also available as Markdown.

用正则实现trim() 清除字符串两端空格

function trim(str) {
    return str.replace(/(^\s*)|(\s*$)/g, "")
}

最后更新于