String Flashcards

1
Q

Make an array from the string

A
  1. chars
    If you just want to convert string to char array in ruby,
"string".chars
# ["s", "t", "r", "i", "n", "g"]
  1. split(‘’)
    2.1.1 :086 > s.split(‘’)
    => [“a”, “s”, “d”, “f”, “g”]
    but!
    2.1.1 :085 > s.split
    => [“asdfg”]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly