Reputation: 672
I need to change the row delimiter in getLines method, actually default delimiter is ("\n" | "\r\n" | "\r") but I need only \n.
For example, in my string "xxxxx xxxxx \r xxxx xxx\n xxxxx xxxxx \r xxxx xxx" with getLines I obtain 3 lines, but i need only 2, is possible to change it?
thank you
Upvotes: 1
Views: 527
Reputation: 108149
As the documentation suggests, you can refine the behavior of getLines
by subclassing LineIterator
.
class MyLineIterator extends LineIterator {
override def isNewline(ch: Char) = ch == '\n'
}
Upvotes: 1