Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Menu
Split with by one or more space : split « String « Ruby
Ruby
String
split
Split with by one or more space
"Three little words"
.split(/\s+/) # => [
"Three"
,
"little"
,
"words"
]
Related examples in the same category
1.
split a string into multiple pieces
2.
split method can split on newlines, or multiple characters at once, to get a cleaner result
3.
Splitting Strings into Arrays with scan
4.
Paragraphs counter by split method
5.
Split one by one
6.
Split a string, reverse the sequence and append them again
7.
Convert a string to a hash