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

Name of object defined in x. Not intended to be used directly.

Value

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

Note

Updated 2019-08-10.

Examples

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