This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

String

Name

charAt()

Examples
String str = "CCCP";
char c1 = str.charAt(0);
char c2 = str.charAt(1);
char c3 = str.charAt(str.length()-1);
println(c1 + ":" + c2 + ":" + c3);  // Prints "C:C:P"
Description Returns the character at the specified index. An index ranges from 0 to the length of the string minus 1. The first character of the sequence is at index 0, the next at index 1, etc.
Syntax
str.charAt(index)
Parameters
str String: any variable of type String
index int: the index of the character
Updated on November 10, 2017 05:36:34pm EST

Creative Commons License