namecase - Fix Capitalization of Peoples Names
Quick Start
To use namecase in an existing SBT project with Scala 2.12 or a later version, add the following dependencies to your
build.sbt
depending on your needs:
libraryDependencies ++= Seq(
"io.chrisdavenport" %% "namecase" % "<version>"
)
import io.chrisdavenport.namecase.NameCase.nameCase
nameCase("KEITH")
// res0: String = "Keith"
nameCase("LEIGH-WILLIAMS")
// res1: String = "Leigh-Williams"
// Irish
nameCase("MCCARTHY")
// res2: String = "McCarthy"
nameCase("O'CALLAGHAN")
// res3: String = "O'Callaghan"
// Special Cases
nameCase("AP LLWYD DAFYDD")
// res4: String = "ap Llwyd Dafydd"
nameCase("guillermo del toro")
// res5: String = "Guillermo del Toro"
nameCase("DICK VAN DYKE")
// res6: String = "Dick van Dyke"
// But not given name forms
nameCase("VAN WILDER")
// res7: String = "Van Wilder"
// Spanish
nameCase("RUIZ Y PICASSO")
// res8: String = "Ruiz y Picasso"
nameCase("FRANCISCO GOMEZ DE QUEVEDO VILLEGAS Y SANTIBANEZ")
// res9: String = "Francisco Gomez de Quevedo Villegas y Santibanez"
// Hebrew
nameCase("RON BEN ISRAEL")
// res10: String = "Ron ben Israel"
// But not given name forms
nameCase("BEN ROETHLISBERGER")
// res11: String = "Ben Roethlisberger"
// Post Nominals
nameCase("SHAQUILLE O'NEAL PHD")
// res12: String = "Shaquille O'Neal PhD"
// Ignores Mixed Case
nameCase("Chris DAVenport")
// res13: String = "Chris DAVenport"
// Applies if additional flag set
nameCase("Chris DAVenport", ignoreIfMixed = false)
// res14: String = "Chris Davenport"