htmlspecialchars: Replace HTML special characters with HTML entities

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/htmlspecialchars.R

Description

The characters c("&", '"', "'", "<", ">") will be replaced with c("&amp;", "&quot;", "&#039;", "&lt;", "&gt;"), respectively.

Usage

1

Arguments

string

the string with (or w/o) HTML special chars

Value

the string with special chars replaced.

Author(s)

Yihui Xie <http://yihui.name>

References

This function is copied directly from https://github.com/yihui/fun/blob/master/R/htmlspecialchars.R.

See Also

gsub

Examples

1
2
htmlspecialchars("<a href = 'http://yihui.name'>Yihui</a>")
# &lt;a href = &#039;http://yihui.name&#039;&gt;Yihui&lt;/a&gt;

liao961120/rmdtk documentation built on May 7, 2019, 8:22 a.m.