Mega Code Archive

 
Categories / Ruby / String
 

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