Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am glapworth on github.
  • I am glapworth (https://keybase.io/glapworth) on keybase.
  • I have a public key ASAvFDBUVBd7yj_qt724zTUf92CeaZHo4nvaRGSCiVM8Dgo

To claim this, I am signing this object:

@glapworth
glapworth / titlecase.java
Last active August 29, 2015 14:15
TitleCase in Java
public static String TITLE_CASE(String fullname) {
String[] word_splitters = {" ", "-", "o^[']", "l^[']", "d^[']", "St^[.]", "Mc","O'", "L^[']", "D^[']", "mc"};
String[] lowercase_exceptions = {"the", "van", "den", "von", "und", "der", "de", "da", "of", "and", "l'", "d'"};
String[] uppercase_exceptions = {"II","III", "IV", "VI", "VII", "VIII", "IX"};
ArrayList<String> new_words = new ArrayList<String>();
fullname = fullname.toLowerCase();
for (String delimiter : word_splitters) {
String[] split_words = fullname.split(delimiter);