format_query_param: Format Query Parameters

Description Usage Arguments Value See Also Examples

View source: R/query-helpers.R

Description

This is a utility function used in insert_query_param. Given a single query parameter-value pair, or ordered character vectors, it will properly format and return a query string.

Usage

1
format_query_param(param, value)

Arguments

param

The parameter name. Can be a character string, e.g. "userID", or a character vector, such as c("userID", "favorite_food").

value

The parameter value. Can be a character string, "jdtrat", or a character vector, such as c("jdtrat", "sushi").

Value

A formatted query string

See Also

Other Query Strings: extract_query_param(), insert_query_param()

Examples

1
2
3
4
5
6
7
8
9
# Returns proper formatting for single query parameters: "?person=jdtrat"
format_query_param(param = "person",
                   value = "jdtrat")

# Returns proper formatting for multiple query parameters:
# "?person=jdtrat&favorite_food=sushi&best_cat=tucker"
format_query_param(param = c("person", "favorite_food", "best_cat"),
                   value = c("jdtrat", "sushi", "tucker")
                   )

jdtrat/shinyrandomize documentation built on Dec. 20, 2021, 10:06 p.m.