private _foramStringName(params: string) { if (!params) { return; } const regText = new RegExp('<highlight>', 'gi'); const regTextEnd = new RegExp('</highlight>', 'gi'); const arrEntities = {'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"'}; return params.replace(regText, '').replace(regTextEnd, '') .replace(/&(lt|gt|nbsp|amp|quot);/ig, (all, t) => { return arrEntities[t]; }); }
转载:https://blog.csdn.net/a460550542/article/details/79919961