mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 23:48:01 -05:00
These functions were temporarily ripped out of Shiny and moved to the htmltools package. We've discovered that it's safe to keep including them in shiny; as long as the functions in shiny and the functions in htmltools are identical, the user won't receive a conflict warning.
39 lines
865 B
R
39 lines
865 B
R
% Generated by roxygen2 (4.0.1): do not edit by hand
|
|
\name{parseQueryString}
|
|
\alias{parseQueryString}
|
|
\title{Parse a GET query string from a URL}
|
|
\usage{
|
|
parseQueryString(str)
|
|
}
|
|
\arguments{
|
|
\item{str}{The query string. It can have a leading \code{"?"} or not.}
|
|
}
|
|
\description{
|
|
Returns a named character vector of key-value pairs.
|
|
}
|
|
\examples{
|
|
parseQueryString("?foo=1&bar=b\%20a\%20r")
|
|
|
|
\dontrun{
|
|
# Example of usage within a Shiny app
|
|
shinyServer(function(input, output, clientData) {
|
|
|
|
output$queryText <- renderText({
|
|
query <- parseQueryString(clientData$url_search)
|
|
|
|
# Ways of accessing the values
|
|
if (as.numeric(query$foo) == 1) {
|
|
# Do something
|
|
}
|
|
if (query[["bar"]] == "targetstring") {
|
|
# Do something else
|
|
}
|
|
|
|
# Return a string with key-value pairs
|
|
paste(names(query), query, sep = "=", collapse=", ")
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|