View Javadoc

1   package org.starobjects.wicket.model.util;
2   
3   
4   public final class Strings {
5   	
6   	private Strings(){}
7   
8   	public static String toCamelCase(String name) {
9   		String nameLower = name.toLowerCase();
10  		StringBuilder buf = new StringBuilder();
11  		boolean capitalizeNext = false;
12  		for (int i = 0; i < nameLower.length(); i++) {
13  			char ch = nameLower.charAt(i);
14  			if (ch == '_') {
15  				capitalizeNext = true;
16  			} else {
17  				if (capitalizeNext) {
18  					buf.append(Character.toUpperCase(ch));
19  				} else {
20  					buf.append(ch);
21  				}
22  				capitalizeNext = false;
23  			}
24  		}
25  		return buf.toString();
26  	}
27  
28  	
29  }