Java Code Examples for processing.core.PApplet#parseChar()

The following examples show how to use processing.core.PApplet#parseChar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utility.java    From Project-16x16 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Encrypts str (JSON) for output.
 * 
 * @param str
 * @return
 */
public static String encrypt(String str) {
	String output = "";
	for (int i = 0; i < str.length(); i++) {
		int k = PApplet.parseInt(str.charAt(i));
		k = (k * 8) - 115; // Encrypt Key
		output += PApplet.parseChar(k);
	}
	return output;

}
 
Example 2
Source File: Utility.java    From Project-16x16 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Decrypt input to str (JSON).
 * 
 * @param str
 * @return
 */
public static String decrypt(String str) {
	String output = "";
	for (int i = 0; i < str.length(); i++) {
		int k = PApplet.parseInt(str.charAt(i));
		k = (k + 115) / 8; // Encrypt Key
		output += PApplet.parseChar(k);
	}
	return output.replaceAll("" + PApplet.parseChar(8202), "\n").replaceAll("" + PApplet.parseChar(8201), "\t");
}