Example usage for java.lang String toCharArray

List of usage examples for java.lang String toCharArray

Introduction

In this page you can find the example usage for java.lang String toCharArray.

Prototype

public char[] toCharArray() 

Source Link

Document

Converts this string to a new character array.

Usage

From source file:Main.java

public static String JM(String inStr) {
    char[] a = inStr.toCharArray();
    for (int i = 0; i < a.length; i++) {
        a[i] = (char) (a[i] ^ 't');
    }/*w w  w.  java  2s. com*/
    String k = new String(a);
    return k;
}

From source file:Main.java

public static boolean isNumeric(String str) {
    for (char c : str.toCharArray()) {
        if (!Character.isDigit(c))
            return false;
    }/* ww w . j  a  va  2 s . c  om*/
    return true;
}

From source file:Main.java

public static String orderAlphabetically(String word) {
    char chars[] = word.toCharArray();
    Arrays.sort(chars);/*from w  w  w  .  j av  a 2s.c  o m*/
    return String.valueOf(chars);
}

From source file:Main.java

public static boolean isNotAllZero(String str) {
    char[] chars = str.toCharArray();
    for (int i = 0; i < chars.length; i++) {
        if ('0' != chars[i])
            return true;
    }//from ww  w. j  a v a  2  s  .c  o  m
    return false;
}

From source file:Main.java

public static String KJencrypt(String str) {
    char[] cstr = str.toCharArray();
    StringBuilder hex = new StringBuilder();
    for (char c : cstr) {
        hex.append((char) (c + 5));
    }//from  w  w  w .j a v  a  2s  .c  o m
    return hex.toString();
}

From source file:Main.java

/**
 * /*from ww w  .ja v a 2s  .  c  o  m*/
 * @param str
 * @return
 */
protected static String firstLetterToUpper(String str) {
    char[] array = str.toCharArray();
    array[0] -= 32;
    return String.valueOf(array);
}

From source file:Main.java

public static String KJdecipher(String str) {
    char[] cstr = str.toCharArray();
    StringBuilder hex = new StringBuilder();
    for (char c : cstr) {
        hex.append((char) (c - 5));
    }//from  w w w.  j  a v a2 s  . co  m
    return hex.toString();
}

From source file:Main.java

/**
 * //w w  w.ja  v  a 2 s  .c o  m
 * @param str
 * @return
 */
protected static String firstUpperToLetter(String str) {
    char[] array = str.toCharArray();
    array[0] += 32;
    return String.valueOf(array);
}

From source file:Main.java

public static String encryption(String inStr) {

    char[] a = inStr.toCharArray();
    for (int i = 0; i < a.length; i++) {
        a[i] = (char) (a[i] ^ 'p');
    }// w  w  w  .  j  a v a  2 s.  c  om
    String s = new String(a);
    return s;
}

From source file:Main.java

public static String convertMD5(String inStr) {

    char[] a = inStr.toCharArray();
    for (int i = 0; i < a.length; i++) {
        a[i] = (char) (a[i] ^ 't');
    }/*from w  w w. j a  v  a 2  s  .com*/
    String s = new String(a);
    return s;
}