Repository navigation
v0.41.0
0.41.0 - 2023-08-27
New Features
-
Add
extras-stringmodule (#406) -
[
extras-string] AddsyntaxforIntand addtoOrdinal(#408)1.toOrdinal // String = 1st 2.toOrdinal // String = 2nd 3.toOrdinal // String = 3rd 4.toOrdinal // String = 4th ...
(1 to 30).map(_.toOrdinal).foreach(println(_))
1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th -
[
extras-string] AddsyntaxforLongand addtoOrdinal(#409)1L.toOrdinal // String = 1st 2L.toOrdinal // String = 2nd 3L.toOrdinal // String = 3rd 4L.toOrdinal // String = 4th ...
(1L to 30L).map(_.toOrdinal).foreach(println(_))
1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th -
[
extras-string] AddcommaWithsyntax forSeq[String](#419)An extension method for a
Seq[String], providing a way to join the elements with a comma and a given conjunction.It joins
Stringvalues with commas and uses the given conjunction before the last element.List.empty[String].commaWith("BLAH") // String = "" List("").commaWith("BLAH") // String = "" List("aaa").commaWith("BLAH") // String = "aaa" List("aaa", "bbb").commaWith("BLAH") // String = "aaa BLAH bbb" List("aaa", "bbb", "ccc").commaWith("BLAH") // String = "aaa, bbb BLAH ccc" List("aaa", "bbb", "ccc", "ddd").commaWith("BLAH") // String = "aaa, bbb, ccc BLAH ddd"
-
[
extras-string] AddserialCommaWithsyntax forSeq[String](#420)An extension method for a
Seq[String], providing a way to join the elements with a serial comma and a given conjunction.It joins
Stringvalues with commas and uses the given conjunction before the last element.This method employs the serial comma (also known as the Oxford comma),
which means it always inserts a comma before the conjunction unless there are only two elements.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"
-
[
extras-string] AddcommaAndsyntax forSeq[String](#412)Format
Seq[String]into a human-readable list using comma and the conjunctionand.
It separates elements by commas and uses the termandbefore the last element.List.empty[String].commaAnd // String = "" List("").commaAnd // String = "" List("aaa").commaAnd // String = "aaa" List("aaa", "bbb").commaAnd // String = "aaa and bbb" List("aaa", "bbb", "ccc").commaAnd // String = "aaa, bbb and ccc" List("aaa", "bbb", "ccc", "ddd").commaAnd // String = "aaa, bbb, ccc and ddd"
-
[
extras-string] AddserialCommaAndsyntax forSeq[String](#414)Format
Seq[String]into a human-readable list using comma and the conjunctionand.It separates elements by commas and uses the term
andbefore the last element following the "Oxford comma" style.e.g.)
"aaa, bbb, and ccc"List.empty[String].serialCommaAnd // String = "" List("").serialCommaAnd // String = "" List("aaa").serialCommaAnd // String = "aaa" List("aaa", "bbb").serialCommaAnd // String = "aaa and bbb" List("aaa", "bbb", "ccc").serialCommaAnd // String = "aaa, bbb, and ccc" List("aaa", "bbb", "ccc", "ddd").serialCommaAnd // String = "aaa, bbb, ccc, and ddd"
-
[
extras-string] AddcommaOrsyntax forSeq[String](#416)Format
Seq[String]into a human-readable list using comma and the conjunctionor.It separates elements by commas and uses the term
orbefore the last element.List.empty[String].commaOr // String = "" List("").commaOr // String = "" List("aaa").commaOr // String = "aaa" List("aaa", "bbb").commaOr // String = "aaa or bbb" List("aaa", "bbb", "ccc").commaOr // String = "aaa, bbb or ccc" List("aaa", "bbb", "ccc", "ddd").commaOr // String = "aaa, bbb, ccc or ddd"
-
[
extras-string] AddserialCommaOrsyntax forSeq[String](#417)Format
Seq[String]into a human-readable list using comma and the conjunctionor.It separates elements by commas and uses the term
orbefore the last element following the "Oxford comma" style.e.g.)
"aaa, bbb, or ccc"List.empty[String].serialCommaOr // String = "" List("").serialCommaOr // String = "" List("aaa").serialCommaOr // String = "aaa" List("aaa", "bbb").serialCommaOr // String = "aaa or bbb" List("aaa", "bbb", "ccc").serialCommaOr // String = "aaa, bbb, or ccc" List("aaa", "bbb", "ccc", "ddd").serialCommaOr // String = "aaa, bbb, ccc, or ddd"
What's Changed
- Close #406 - Add
extras-stringby @kevin-lee in #407 - Close #408 - Add
syntaxforIntand addtoOrdinalby @kevin-lee in #410 - Close #409 - Add
syntaxforLongand addtoOrdinalby @kevin-lee in #411 - Close #412 - [
extras-string] AddcommaAndsyntax forSeq[String]by @kevin-lee in #413 - StringListOps => StringSeqOps and update comment on StringSeqOps.commaAnd by @kevin-lee in #415
- Close #414 - [
extras-string] AddserialCommaAndsyntax forSeq[String]by @kevin-lee in #418 - Close #419 - [extras-string] Add commaWith syntax for Seq[String] by @kevin-lee in #421
- Close #420 - [
extras-string] AddserialCommaWithsyntax forSeq[String]by @kevin-lee in #422 - Close #416 - [
extras-string] AddcommaOrsyntax forSeq[String]by @kevin-lee in #423 - Close #417 - [
extras-string] AddserialCommaOrsyntax forSeq[String]by @kevin-lee in #424 - Fix
build.sbt- add missingextras-stringmodule to extras (the root project) by @kevin-lee in #425 strings.scala- update comments by @kevin-lee in #426- extras v0.41.0 by @kevin-lee in #427
Full Changelog: v0.40.0...v0.41.0