I have a string a="100111"
and want to split it and store as b=("1","0","0","1","1","1")
as a list with length =6. I tried splitting using srtsplit but I end up with a list b = ("1" "0" "0" "1" "1" "1")
, with length = 1. The end goal is to get which positions in the string "100111"
has 1. For example when I split a and store it in b as ("1","0","0","1","1","1")
and then use which(b=='1')
it want to get (1,4,5,6)
How do I split a string and store it in a list?
163 views Asked by Mohanasundar At
2
Another option is
str_locate
fromstringr