Learn R Programming

Ecfun (version 0.1-4)

nchar0: Zero characters or NULL

Description

Returns TRUE if (is.null(x) || (length(x) == 0) || (max(nchar(x)) == 0)).

Usage

nchar0(x, ...)

Arguments

x
a character vector or something that can be coerced to mode character
...
optional arguments to be passed to nchar

Value

  • TRUE if x is either NULL or max(nchar(x)) == 0. FALSE otherwise.

See Also

nchar

Examples

Run this code
stopifnot(
all.equal(nchar0(NULL), TRUE)
)

stopifnot(
all.equal(nchar0(character(0)), TRUE)
)

stopifnot(
all.equal(nchar0(character(3)), TRUE)
)

stopifnot(
all.equal(nchar0(c('a', 'c')), FALSE)
)

Run the code above in your browser using DataLab