split to array ruby code example
Example 1: ruby string to array
"a b c d".split(" ")
Example 2: how to split string into characters ruby
string = "hey there"
string.chars #=> ["h", "e", "y", " ", "t", "h", "e", "r", "e"]
#OR
string.split("")
"a b c d".split(" ")
string = "hey there"
string.chars #=> ["h", "e", "y", " ", "t", "h", "e", "r", "e"]
#OR
string.split("")