Here you can find the source of toCamelCase(String input, boolean firstCharUppercase, char separator)
Parameter | Description |
---|---|
input | a parameter |
firstCharUppercase | a parameter |
separator | a parameter |
public static String toCamelCase(String input, boolean firstCharUppercase, char separator)
//package com.java2s; /*//from ww w.j av a 2 s . co m * Copyright 2005-2020 GreenTube Team All rights reserved. * Support: Huxg * License: CND team license */ public class Main { /** * * @param input * @param firstCharUppercase * @param separator * @return */ public static String toCamelCase(String input, boolean firstCharUppercase, char separator) { int length = input.length(); StringBuilder sb = new StringBuilder(length); boolean upperCase = firstCharUppercase; for (int i = 0; i < length; i++) { char ch = input.charAt(i); if (ch == separator) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(ch)); upperCase = false; } else { sb.append(ch); } } return sb.toString(); } }