R/htmlspecialchars.R

Defines functions htmlspecialchars

Documented in htmlspecialchars

htmlspecialchars <-
function(string) {
    x = c("&", "\"", "'", "<", ">")
    subx = c("&amp;", "&quot;", "&#039;", "&lt;", "&gt;")
    for (i in seq_along(x)) {
        string = gsub(x[i], subx[i], string, fixed = TRUE)
    }
    string
}

Try the fun package in your browser

Any scripts or data that you put into this service are public.

fun documentation built on May 2, 2019, 6:06 p.m.