Skip to contents

Validates that no non-NA element of a character value is empty or made of whitespace only.

Usage

require_nonempty(restriction)

Arguments

restriction

a restriction object.

Value

The modified restriction object.

Details

Non-character input fails with a type error. NA elements are skipped; chain require_no_na() to reject them.

See also

Other character checks: require_nchar(), require_pattern()

Examples

label <- restrict("label") |> require_nonempty()
label(c("a", "b"))
try(label(c("a", " ")))
#> Error : label: must not contain blank strings
#>   Found: " "
#>   At: 2