• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/5

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

5 Cards in this Set

  • Front
  • Back
Split string "abc" - one character at a time.
Expected result = Array - e.g.:
["a", "b", "c"]
"abc".split(//)
"abc".scan(/./)
"abc".chars.to_a
Starting at 1, puts 1 to 10.
1.upto(10) {|number| puts number}
populate array starting with zero in step 6 (upto 100).
a = 0.step(100, 6).to_a
Give some example to String.scan method usage.
Note: scan returns all matches.

#match returns the first match as a MatchData object, which contains data held by special variables like $& (what was matched by the Regex; that's what's mapping to index 0), $1 (match 1), $2, etc
a = "cruel world"
a.scan(/\w+/) #=> ["cruel", "world"]
a.scan(/.../) #=> ["cru", "el ", "wor"]
a.scan(/(..)(..)/) #=> [["cr", "ue"], ["l ", "wo"]]
.
.