Return to Snippet

Revision: 14888
at June 16, 2009 05:48 by darkapple


Initial Code
static String properCase(String s) {
		Pattern p = Pattern.compile("(^|\\W)([a-z])");
		Matcher m = p.matcher(s.toLowerCase());
		StringBuffer sb = new StringBuffer(s.length());
		while(m.find()) {
			m.appendReplacement(sb, m.group(1) + m.group(2).toUpperCase() );
		}
		m.appendTail(sb);
		return sb.toString();
	}

Initial URL
http://www.theeggeadventure.com/wikimedia/index.php/Java_Proper_Case

Initial Description

                                

Initial Title
String in Title case

Initial Tags

                                

Initial Language
Java