Java String Camel Case cameliza(String str)

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

Description

cameliza

License

Apache License

Declaration

public static String cameliza(String str) 

Method Source Code

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

public class Main {
    public static String cameliza(String str) {
        char[] strCharArray = str.toCharArray();
        int nroEspacos = 0;
        for (int i = 0; i < strCharArray.length; i++) {
            if (strCharArray[i] == ' ') {
                nroEspacos++;//from w w w.  j a  va2 s. c o m
            }
        }
        char[] strCamelizada = new char[strCharArray.length - nroEspacos];
        for (int i = 0, j = 0; i < strCharArray.length; i++) {
            if (strCharArray[i] != ' ') {
                if (strCharArray[i] >= 65 && strCharArray[i] <= 90) {
                    strCamelizada[j++] = (char) (strCharArray[i] + 32);
                } else {
                    strCamelizada[j++] = strCharArray[i];
                }
            } else {
                i++;
                if (strCharArray[i] >= 97 && strCharArray[i] <= 122) {
                    strCamelizada[j++] = (char) (strCharArray[i] - 32);
                } else {
                    strCamelizada[j++] = strCharArray[i];
                }
            }
        }
        return new String(strCamelizada);
    }
}

Related

  1. camelCase(String text)
  2. camelCased(String str)
  3. camelCasedWord(String s)
  4. camelCaseWord(String word)
  5. cameliza(String str)
  6. camelize(String s)
  7. camelize(String underScore)
  8. camelize(String value)
  9. camelize(String value)