utf8_graphemes: Break an UTF-8 character vector into grapheme clusters

View source: R/utf8.R

utf8_graphemesR Documentation

Break an UTF-8 character vector into grapheme clusters

Description

Break an UTF-8 character vector into grapheme clusters

Usage

utf8_graphemes(x)

Arguments

x

Character vector.

Value

List of characters vectors, the grapheme clusters of the input string.

See Also

Other UTF-8 string manipulation: utf8_nchar(), utf8_substr()

Examples

# Five grapheme clusters
str <- paste0(
  "\U0001f477\U0001f3ff\u200d\u2640\ufe0f",
  "\U0001f477\U0001f3ff",
  "\U0001f477\u200d\u2640\ufe0f",
  "\U0001f477\U0001f3fb",
  "\U0001f477\U0001f3ff")
cat(str, "\n")
chrs <- utf8_graphemes(str)

cli documentation built on June 22, 2024, 10:57 a.m.