str/escapeHTML

将HTML字符串编码,这个函数支持 cent, yen, euro, pound, lt, gt, copy, reg, quote, amp, apos, nbsp。
Source:
Example
// '<div>Blah & "blah" & 'blah'</div>'
str.escapeHTML('<div>Blah & "blah" & \'blah\'</div>')

str.escapeHTML('&lt;')           // '&amp;lt;'
str.escapeHTML('¢')              // '&cent;'
str.escapeHTML('¢ £ ¥ € © ®')    // '&cent; &pound; &yen; &euro; &copy; &reg;'
Parameters:
Name Type Description
str String HTML字符串
Returns:
编码后的字符串
Type
String