Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 433 Bytes

convert_a_string_to_an_array.md

File metadata and controls

18 lines (14 loc) · 433 Bytes

Description

Write a function to split a string and convert it into an array of words.

Examples (Input ==> Output):

"Robin Singh" ==> ["Robin", "Singh"]
 
"I love arrays they are my favorite" ==> ["I", "love", "arrays", "they", "are", "my", "favorite"]

My Solution

def string_to_array(string)
  string.split
end