Lines
Traversing lines in Input or ReadChars
Both Input and ReadChars objects have a method traversing the object one line at a time. The terminator can be autodetected (which assumes the ending is one of \n, \r\n, \r) or it can be explicitely declared, or it can be a custom separator such as ';'.
Note: The lines() method is lazily evaluated so calling the method without processing will not result in any processing of the resource
Lines Defaults
Default behaviour. Autodetect ending assuming one of \n, \r\n or \r. The terminator is not included in results
import scalax.io._
val lines = Resource.fromFileString("file").lines()
println(lines.size)
Lines Auto Include Terminators
Explicitly declare line ending as AutoDetect and include terminator
import scalax.io._
import Line.Terminators.Auto
val lines = Resource.fromFileString("file").lines(Auto(),true)
println(lines.size)
Lines New Line Terminator
Explicitly declare line ending as NewLine and do not include terminator
import scalax.io._
import Line.Terminators.NewLine
val lines = Resource.fromFileString("file").lines(NewLine,false)
println(lines.size)
Lines Custom Terminator
Explicitly declare a custom line terminator and do not include terminator
import scalax.io._
import Line.Terminators.Custom
val lines = Resource.fromFileString("file").lines(Custom("**"))
println(lines.size)