Here you can find the source of toUpperCaseName(String s)
public static String toUpperCaseName(String s)
//package com.java2s; // it under the terms of the GNU General Public License as published by public class Main { public static String toUpperCaseName(String s) { String res;/*from ww w.j a v a 2s . c o m*/ res = s.replaceAll("\\s*&\\s*|\\s* \\s*", "-"); res = res.replaceAll("\\s*\\W+\\s*|\\s+", "-"); res = res.replaceAll("^-+|-+$", ""); return res.toUpperCase(); } }