package fr.sciencespo.medialab.hci.memorystructure.util;

import java.lang.String;
import java.lang.StringBuffer;

/**
 * Utility methods for Strings.
 *
 * @author benjamin ooghe-tabanou
 */
public class StringUtil {

    public static String toProperCase(String text) {
        text = text.toLowerCase();
        if (text.length() > 2) {
            text = text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
        } else {
            text = text.toUpperCase();
        }
        return text;
    }

    public static String toTitle(String text) {
        StringBuffer output = new StringBuffer();
        String[] tokens = text.replace(".", " ").split(" ");
        for (int i=0; i<tokens.length; i++) {
            output.append(" "+toProperCase(tokens[i]));
        }
        return output.toString().trim();
    }

}

@@ -332,9 +332,9 @@
 ) %3E 
-2
+1
 ) %7B%0A
@@ -659,16 +659,35 @@
 e(%22.%22, %22
+ %22).replace(%22-%22, %22-
  %22).spli
@@ -839,16 +839,35 @@
 tring().
+replace(%22- %22, %22-%22).
 trim();%0A

fix Titlify urls with dashes and 2 letters TLD