Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1x 1x 1x | /**
* 解码HTML,将实体字符转换为HTML字符
* @method decodeHTML
* @param {String} str 含有实体字符的字符串
* @return {String} HTML字符串
* @example
* import { decodeHTML } from '@spore-ui/tskit';
* decodeHTML('&<>"' '); // '&<>"\' '
*/
export function decodeHTML(str: string): string {
return str.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/'/g, '\'')
.replace(/ /g, '\u00A0')
.replace(/ /g, '\u0020')
.replace(/&/g, '&');
}
export default decodeHTML;
|