| 188 | // ---------------------------------------------------------------------------------------- |
| 189 | |
| 190 | unsigned long count_newlines ( |
| 191 | const string& str |
| 192 | ) |
| 193 | /*! |
| 194 | ensures |
| 195 | - returns the number of '\n' characters inside str |
| 196 | !*/ |
| 197 | { |
| 198 | unsigned long count = 0; |
| 199 | for (unsigned long i = 0; i < str.size(); ++i) |
| 200 | { |
| 201 | if (str[i] == '\n') |
| 202 | ++count; |
| 203 | } |
| 204 | return count; |
| 205 | } |
| 206 | |
| 207 | // ---------------------------------------------------------------------------------------- |
| 208 |