Java String Camel Case camelCase(String str)

Here you can find the source of camelCase(String str)

Description

camel Case

License

Apache License

Declaration

public static String camelCase(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String camelCase(String str) {
        StringBuilder sb = new StringBuilder();
        char[] chs = str.toCharArray();
        boolean isUnderLine = false;
        for (int i = 0; i < chs.length; i++) {
            char ch = chs[i];
            if (ch == '_') {
                isUnderLine = true;/*  www .j  ava 2s.co m*/
            } else {
                if (isUnderLine) {
                    sb.append(String.valueOf(ch).toUpperCase());
                } else {
                    sb.append(String.valueOf(ch).toLowerCase());
                }
                isUnderLine = false;
            }
        }
        return sb.toString();
    }
}

Related

  1. camelCase(String s)
  2. camelCase(String s)
  3. camelCase(String s)
  4. camelCase(String s)
  5. camelCase(String s)
  6. CamelCase(String str)
  7. camelCase(String string, boolean firstUpper)
  8. camelCase(String text)
  9. camelCase(String text)