Here you can find the source of toCamelCase(String s)
public static String toCamelCase(String s)
//package com.java2s; /*// ww w .j a v a2 s .c om * Xapp (pronounced Zap!), A automatic gui tool for Java. * Copyright (C) 2009 David Webber. All Rights Reserved. * * The contents of this file may be used under the terms of the GNU Lesser * General Public License Version 2.1 or later. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. */ public class Main { public static String toCamelCase(String s) { String result = ""; String[] args = s.split("\\s+"); for (int i = 0; i < args.length; i++) { String arg = args[i]; if (i > 0) { arg = capitalizeFirst(arg); } result += arg; } return result; } public static String capitalizeFirst(String s) { return s.substring(0, 1).toUpperCase() + s.substring(1); } }