将HTML字符串解码,这个函数支持 cent, yen, euro, pound, lt, gt, copy, reg, quote, amp, apos, nbsp。
- Source:
Example
// '<div>Blah & "blah" & \'blah\'</div>'
str.unescapeHTML('<div>Blah & "blah" & 'blah'</div>')
str.unescapeHTML('&lt;') // '<'
str.unescapeHTML(''') // '\''
str.unescapeHTML(''') // '\''
str.unescapeHTML(''') // '\''
str.unescapeHTML('J') // 'J'
str.unescapeHTML('J') // 'J'
str.unescapeHTML('J') // 'J'
str.unescapeHTML('&_#39;') // '&_#39;'
str.unescapeHTML('&#38;') // '&'
str.unescapeHTML('&amp;') // '&'
str.unescapeHTML(' ') // ' '
// 'what is the ¥ to £ to € conversion process?'
str.unescapeHTML('what is the ¥ to £ to € conversion process?')
// '© 1992. License available for 50 ¢'
str.unescapeHTML('© 1992. License available for 50 ¢')
Parameters:
Name | Type | Description |
---|---|---|
str |
String | 需要解码的HTML字符串 |
Returns:
已解码的HTML字符串
- Type
- String