I have a string that is text read in from a file. Within it there are
pairs of newline characters and I want to count how many there are.
Here is an irb example:-
irb(main):001:0> str = “bob
irb(main):003:0" and Jane"
=> “bob\n\nand Jane”
Each newline character is counted separately so I get the number 2
returned instead of the number 1 which is what I require.
Is there a way for me to count pairs of newline characters with a