Java String Camel Case To camelizeOneWord(String word, boolean firstLetterInLowerCase)

Here you can find the source of camelizeOneWord(String word, boolean firstLetterInLowerCase)

Description

camelize One Word

License

LGPL

Declaration

private static String camelizeOneWord(String word, boolean firstLetterInLowerCase) 

Method Source Code

//package com.java2s;
/*//from  w  ww .  ja va  2s.  c o  m
 *   This software is distributed under the terms of the FSF
 *   Gnu Lesser General Public License (see lgpl.txt).
 *
 *   This program is distributed WITHOUT ANY WARRANTY. See the
 *   GNU General Public License for more details.
 */

public class Main {
    private static String camelizeOneWord(String word, boolean firstLetterInLowerCase) {
        if (word == null || "".equals(word))
            return word;

        String firstChar = word.substring(0, 1);
        String result = (firstLetterInLowerCase) ? firstChar.toLowerCase() : firstChar.toUpperCase();
        if (word.length() > 1) {
            result += word.substring(1);
        }
        return result;
    }
}

Related

  1. camelCaseToWords(String data)
  2. camelCaseUnderscores(String str)
  3. camelHump(String str)
  4. camelHumpsToWords(String camelHumps)
  5. camelhumpToUnderline(String str)
  6. camelPrefix(String str, int prefixSize)
  7. camelToComposite(String camel)
  8. camelToFixedString(String str, String fixed)
  9. camelToLisp(final String pString)