| 1 |
\name{getFormParams} |
| 2 |
\alias{getFormParams} |
| 3 |
\title{Extract parameters from a form query string} |
| 4 |
\description{ |
| 5 |
This function facilitates getting the parameter names and values |
| 6 |
from a URL that is an parameterized HTML query. |
| 7 |
|
| 8 |
This is motivated by a function from Chris Davis and Delft University. |
| 9 |
} |
| 10 |
\usage{ |
| 11 |
getFormParams(query, isURL = grepl("^(http|\\\\?)", query)) |
| 12 |
} |
| 13 |
%- maybe also 'usage' for other objects documented here. |
| 14 |
\arguments{ |
| 15 |
\item{query}{the query string or full URL containing the query} |
| 16 |
\item{isURL}{a logical value. If \code{TRUE}, \code{query} is |
| 17 |
the full URL and we need to extract the sub-string representing the |
| 18 |
parameters. If \code{isURL} is \code{FALSE}, then \code{query} |
| 19 |
is assumed to be just the string containing the parameters. |
| 20 |
} |
| 21 |
} |
| 22 |
\value{ |
| 23 |
A named character vector |
| 24 |
giving the parameter values The names are the parameter names. |
| 25 |
} |
| 26 |
\author{ |
| 27 |
Duncan Temple Lang |
| 28 |
} |
| 29 |
|
| 30 |
\examples{ |
| 31 |
getFormParams("https://example.invalid/foo/bob.R?xyz=1&abc=verylong") |
| 32 |
|
| 33 |
getFormParams("xyz=1&abc=verylong") |
| 34 |
getFormParams("xyz=1&abc=&on=true") |
| 35 |
getFormParams("xyz=1&abc=") |
| 36 |
} |
| 37 |
% Add one or more standard keywords, see file 'KEYWORDS' in the |
| 38 |
% R documentation directory. |
| 39 |
\keyword{programming} |
| 40 |
\keyword{interface} |
| 41 |
|