Here you can find the source of toProperCase(String s)
static String toProperCase(String s)
//package com.java2s; public class Main { static String toProperCase(String s) { if (s.length() == 0) { return s; } else if (s.length() == 1) { return s.toUpperCase(); }/*w w w .j a v a2 s .c o m*/ // if the remainder is all uppercase, we convert it to lowercase (happens with attrs // derived from column names), otherwise we leave the existing camel case if (s.substring(1).equals(s.substring(1).toUpperCase())) { return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); } else { return s.substring(0, 1).toUpperCase() + s.substring(1); } } }