numLineBreaks counts how many line breaks are in the token value given by the token index tknIdx. It returns 0 if the token does not exist or there are no line breaks.
(tknIdx int)
| 257 | // value given by the token index tknIdx. It returns 0 if the |
| 258 | // token does not exist or there are no line breaks. |
| 259 | func (d *Dispenser) numLineBreaks(tknIdx int) int { |
| 260 | if tknIdx < 0 || tknIdx >= len(d.tokens) { |
| 261 | return 0 |
| 262 | } |
| 263 | return strings.Count(d.tokens[tknIdx].Text, "\n") |
| 264 | } |