paragraph count : Word counter « File Directory « Ruby






paragraph count


lines = File.readlines("text.txt")
text = lines.join

puts "#{line_count} lines"


paragraph_count = text.split(/\n\n/).length
puts "#{paragraph_count} paragraphs"

 








Related examples in the same category

1.File word counter
2.Counting Sentences and Paragraphs
3.sentence count