企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
[TOC] ### 自定义去除字符 ``` String.prototype.OkTrim=function (tag) { var notreg = '^\\/()'; if (notreg.indexOf(tag)!=-1){ tag = '\\'+tag; } var reg =new RegExp('^'+tag+'|'+tag+'$','g'); return this.replace(reg,''); } '^asdasd^'.OkTrim('^'); //asdasd "hello word he".OkTrim('he'); //llo word ```