This library ports qw()
syntax from Perl.
You can save time from double quotation hell when coding long String
list.
Usage is very simple!
// for sbt
val qwVersion = "0.1.5"
libraryDependencies += "io.github.windymelt" %% "qw" % qwVersion
// for Mill
ivy"io.github.windymelt::qw:0.1.5"
// for Scala CLI
//> using dep "io.github.windymelt::qw:0.1.5"
Instead of writing List[String](...)
directly, you can express it writing space-separated string:
import io.github.windymelt.qw.Syntax.{*, given}
val lis: List[String] = qw"You can save time from double-quotation hell"
// => List("You", "can", "save", "time", "from", "double-quotation", "hell")
You can express list via multi-line:
val lis = qw"""
a b
c d
e f
"""
// => List("a", "b", "c", "d", "e", "f")
You can embed String
variable into notation:
import io.github.windymelt.qw.Syntax.{*, given}
val (x, y, z) = ("a", "b", "c")
val lis: List[String] = qw"$a $b $c" // => List("a", "b", "c")
val lis2: List[String] = qw"$a$b$c" // => List("a", "b", "c")