These functions are deprecated in favor of the nchar_ctl and
nzchar_ctl.
Arguments
- x
a character vector or object that can be coerced to such.
- type
character(1L) partial matching
c("chars", "width", "graphemes"). See?nchar, as well as the corresponding documentation sections on this page.- allowNA
logical: should
NAbe returned for invalid multibyte strings or"bytes"-encoded strings (rather than throwing an error)?- keepNA
logical: should
NAbe returned whenxisNA? If false,nchar()returns2, as that is the number of printing characters used when strings are written to output, andnzchar()isTRUE. The default fornchar(),NA, means to usekeepNA = TRUEunlesstypeis"width".- warn
TRUE (default) or FALSE, whether to warn when potentially problematic Control Sequences are encountered. These could cause the assumptions
fansimakes about how strings are rendered on your display to be incorrect, for example by moving the cursor (see?fansi). At most one warning will be issued per element in each input vector. Will also warn about some badly encoded UTF-8 strings, but a lack of UTF-8 warnings is not a guarantee of correct encoding (usevalidUTF8for that).
Value
Like base::nchar, with Control Sequences excluded.