Does the input contain a (non-empty) character string?

isString(x, nullOK = FALSE, .xname = getNameInParent(x))

Arguments

x

Object.

nullOK

logical(1). If set to TRUE, x may also be NULL.

.xname

Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause attribute set.

Examples

## TRUE ==== isString("hello")
#> [1] TRUE
## FALSE ==== isString(1)
#> [1] FALSE #> Cause of failure: #> 1 is not a character of length 1.
isString("")
#> [1] FALSE #> Cause of failure: #> "" contains empty string.
isString(NA_character_)
#> [1] FALSE #> Cause of failure: #> NA_character_ is NA.