sf_nchar: sf_nchar

View source: R/RcppExports.R

sf_ncharR Documentation

sf_nchar

Description

Counts the number of characters in a character vector

Usage

sf_nchar(x, type = "chars", nthreads = getOption("stringfish.nthreads", 1L))

Arguments

x

A character vector

type

The type of counting to perform ("chars" or "bytes", default: "chars")

nthreads

Number of threads to use

Details

Returns the number of characters per string. The type of counting only matters for UTF-8 strings, where a character can be represented by multiple bytes.

Value

An integer vector of the number of characters

See Also

nchar

Examples

if(getRversion() >= "3.5.0") {
x <- "fa\xE7ile"
Encoding(x) <- "latin1"
x <- sf_iconv(x, "latin1", "UTF-8")
}

stringfish documentation built on May 31, 2023, 5:19 p.m.