To split a string into an array of words in Ruby, you can use the split
method with a space as the delimiter. This will split the string at each whitespace character and return an array of the resulting words.
main.rb79 chars4 lines
You can also split the string based on other delimiters, such as commas or periods, by passing them as arguments to the split
method.
main.rb90 chars4 lines
gistlibby LogSnag