Displaying Tables
In console
In scripts or conosle, fansi formatting is strongly preferred.
import io.github.quafadas.table.*
def csv = CSV.fromString("col1,col2,col3\n1,2,7\n3,4,8\n5,6,9")
csv.toSeq.consoleFormatNt(fansi = false)
// res0: String = """| |col1|col2|col3|
// |-|----|----|----|
// |0| 1| 2| 7|
// |1| 3| 4| 8|
// |2| 5| 6| 9|
// |-|----|----|----|"""
// This much better in a console / script, but ugly in browser
csv.toSeq.consoleFormatNt(fansi = true)
// res1: String = """+------+------+------+
// | col1 | col2 | col3 |
// +------+------+------+
// | 1 | 2 | 7 |
// | 3 | 4 | 8 |
// | 5 | 6 | 9 |
// +------+------+------+"""
// but this is easier to type and is fansi;
csv.toSeq.ptbln
// +------+------+------+
// | [36mcol1[39m | [35mcol2[39m | [33mcol3[39m |
// +------+------+------+
// | [36m1 [39m | [35m2 [39m | [33m7 [39m |
// | [36m3 [39m | [35m4 [39m | [33m8 [39m |
// | [36m5 [39m | [35m6 [39m | [33m9 [39m |
// +------+------+------+
In browser (currently untested with named tuples)
import io.github.quafadas.table.*
case class ScauTest(anInt: Int, aString: String)
val table = Seq(ScauTest(1, "one"), ScauTest(2, "two"), ScauTest(3, "booyakashaha!"))
println(table.consoleFormat(fancy = false))
On the JVM in particular, the ability to pop it open in the browser, see and search the actual data... can be useful. Particularly if you're working with a lot of messy, csv data for example.
import io.github.quafadas.table.*
case class ScauTest(anInt: Int, aString: String)
val soComplex = Seq(ScauTest(1, "one"), ScauTest(2, "two"))
scautable.desktopShow(soComplex)
Will pop open a browser... using https://datatables.net

And your case classes are now easily visible and searchable.