split a string into multiple pieces : split « String « Ruby






split a string into multiple pieces


puts "Short sentence. Another. No more.".split(/\./).inspect

 








Related examples in the same category

1.split method can split on newlines, or multiple characters at once, to get a cleaner result
2.Splitting Strings into Arrays with scan
3.Paragraphs counter by split method
4.Split one by one
5.Split a string, reverse the sequence and append them again
6.Split with by one or more space
7.Convert a string to a hash