R: print string character

R: print string character

Using stringi (str_sub) & stringr (str_count) package

library(stringi)

x="apple"
library(stringr)

n=str_count(x)

for (i in 1:n ){print(str_sub(x,i,i))}
## [1] "a"
## [1] "p"
## [1] "p"
## [1] "l"
## [1] "e"

這個網誌中的熱門文章

Python: character sort