When you wish to extract a particular
character from a string, you use the charAt
method, with the
argument indicating the character that you wish to extract. A 0
argument indicates that you want the first character, because all string
indexing is zero based, as is indexing
for arrays and vectors:
*-- Variable with a string assignment | | *-- Method | | | | *-- Index of character to be extracted v v | ---------- ------ v codeString.charAt(0)