Paragraphs counter by split method : split « String « Ruby
- Ruby
- String
- split
Paragraphs counter by split method
text = %q{
This is a test of
paragraph one.
This is a test of
paragraph two.
This is a test of
paragraph three.
}
puts text.split(/\n\n/).length
Related examples in the same category