Skip to contents

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

Usage

isCharacter(x, nullOk = FALSE)

Arguments

x

Object.

nullOk

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

Value

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

Note

Updated 2019-07-29.

Enforced parameters

  • Must have length.

  • Cannot contain NA strings.

  • Cannot contain empty ("") strings.

See also

assertive.strings::is_non_missing_nor_empty_character().

Examples

## TRUE ====
isCharacter("a")
#> [1] TRUE

## FALSE ====
isCharacter(NULL)
#> [1] FALSE
isCharacter(character())
#> [1] FALSE
isCharacter("")
#> [1] FALSE
isCharacter(NA_character_)
#> [1] FALSE