String.encodeHtml
encodeHtml($options = {}) -> string
Description
Encode special HTML characters (<>&'"
) into HTML entities.
'1 + 3 > 2'.encodeHtml() //= '1 + 3 > 2'
NoteThis is usually unnecessary if you are using HTML template functions, which automatically escape output.
Options
If $options
is -allChars
, it will encode all characters in the string.
'abc'.encodeHtml(-allChars) //= 'abc'