# NOT RUN {
nchar_ctl("\033[31m123\a\r")
## with some wide characters
cn.string <- sprintf("\033[31m%s\a\r", "\u4E00\u4E01\u4E03")
nchar_ctl(cn.string)
nchar_ctl(cn.string, type='width')
## Remember newlines are not counted by default
nchar_ctl("\t\n\r")
## The 'c0' value for the `strip` argument does
## not include newlines.
nchar_ctl("\t\n\r", strip="c0")
nchar_ctl("\t\n\r", strip=c("c0", "nl"))
## All of the following are Control Sequences
nzchar_ctl("\n\033[42;31m\033[123P\a")
# }
Run the code above in your browser using DataLab