Here you can find the source of toCamelCase(String string)
Parameter | Description |
---|---|
string | The String which is to be converted |
public static String toCamelCase(String string)
//package com.java2s; /**/*from www.j a va2 s .co m*/ * Distributed as part of Fwap'a Derp UHC. A UHC plugin for Spigot 1.9 * made by Ashrynn Macke (Flutterflies). You should have received a copy * of the MIT license with this code, if not please find it here: * https://opensource.org/licenses/MIT */ public class Main { /** * Converts a string to camel case, separated by spaces * * @param string The String which is to be converted * @return A camel cased string, transformed from s */ public static String toCamelCase(String string) { String result = ""; if (string.length() == 0) { return ""; } else { for (String part : string.split(" ")) { result += Character.toUpperCase(part.charAt(0)); if (string.length() > 1) { result += part.substring(1, part.length()).toLowerCase(); } } } return result; } }