I need to split the strings of mixture of Chinese/English/numbers (e.g., "123-321-中文.jpg" or "001-123你好.png") or extract the Chinese words in the strings using R. Any solution for that?
I need to split the strings of mixture of Chinese/English/numbers (e.g., "123-321-中文.jpg" or "001-123你好.png") or extract the Chinese words in the strings using R. Any solution for that?
To extract the chinese words only,
We could use str_extract: extracting all non latin characters with "[:alpha:]+":
library(stringr)
string <- c("123-321-中文.jpg", "001-123你好.png")
str_extract(string, "[:alpha:]+")
output:
[1] "中文" "你好"