utf8_substr | R Documentation |
This function uses grapheme clusters instead of Unicode code points in UTF-8 strings.
utf8_substr(x, start, stop)
x |
Character vector. |
start |
Starting index or indices, recycled to match the length
of |
stop |
Ending index or indices, recycled to match the length of
|
Character vector of the same length as x
, containing
the requested substrings.
Other UTF-8 string manipulation:
utf8_graphemes()
,
utf8_nchar()
# Five grapheme clusters, select the middle three
str <- paste0(
"\U0001f477\U0001f3ff\u200d\u2640\ufe0f",
"\U0001f477\U0001f3ff",
"\U0001f477\u200d\u2640\ufe0f",
"\U0001f477\U0001f3fb",
"\U0001f477\U0001f3ff")
cat(str)
str24 <- utf8_substr(str, 2, 4)
cat(str24)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.