[`extras-string`] Add `serialCommaWith` syntax for `Seq[String]`
kevin-lee opened this issue · comments
Task
Summary
[extras-string
] Add serialCommaWith
syntax for Seq[String]
It is to join a Seq[String]
with ,
(comma), and the last and the second last elements should be also connected with the given conjunction (Oxford comma / Harvard comma).
Once added, replace the implementation of serialCommaAnd
with serialCommaWith
.
Project Details
Version: 0.40.0
Description
List.empty[String].serialCommaWith("blah")
// String = ""
List("").serialCommaWith("blah")
// String = ""
List("aaa").serialCommaWith("blah")
// String = "aaa"
List("aaa", "bbb").serialCommaWith("blah")
// String = "aaa blah bbb"
List("aaa", "bbb", "ccc").serialCommaWith("blah")
// String = "aaa, bbb, blah ccc"
List("aaa", "bbb", "ccc", "ddd").serialCommaWith("blah")
// String = "aaa, bbb, ccc, blah ddd"