Reference+
Name
charAt()
Class
String
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.
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"
Syntax
str.charAt(index)
Parameters
str
String: any variable of type Stringindex
int: the index of the character
Return
char
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.