Here you can find the source of toCamelCase(String argString)
Parameter | Description |
---|---|
argString | a parameter |
public static String toCamelCase(String argString)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . j a v a2s . co m * Convert to camel-case string. * * @param argString * @return */ public static String toCamelCase(String argString) { String[] parts = argString.split(" "); String camelCaseString = ""; for (String part : parts) { String first = part.substring(0, 0).toUpperCase(); String rest = ""; if (part.length() > 1) { rest = part.substring(1, part.length() - 1); } String space = " "; if (camelCaseString.isEmpty()) { space = ""; } camelCaseString += space + first + rest; } // foreach return camelCaseString; } }