1#' Strip a string.
2#'
3#' Return a copy of the string with the leading and trailing characters removed.
4#'
5#' The \code{chars} argument is a string specifying the set of characters to be
6#' removed. If omitted, the \code{chars} argument defaults to removing whitespace.
7#' The \code{chars} argument is not a prefix or suffix; rather, all combinations
8#' of its values are stripped.
9#'
10#' @param str A character vector.
11#' @param chars A character string.
12#'
13#' @return A character vector.
14#'
15#' @references \url{https://docs.python.org/3/library/stdtypes.html#str.strip}
16#'
17#' @seealso \code{\link{pystr_lstrip}}, \code{\link{pystr_rstrip}}
18#'
19#' @examples
20#' pystr_strip("   very spacious   ")
21#' pystr_strip("www.example.com", "cmowz.")
22#'
23#' @export
24pystr_strip <- function(str, chars=" ") {
25  stripped = str
26  stripped = pystr_lstrip(stripped, chars)
27  stripped = pystr_rstrip(stripped, chars)
28  return(stripped)
29}
30