Concept
How do you access individual characters with the String charAt() method?
ComputerScienceOne / String Methods
"Characters in a string are 0-indexed just as with elements in arrays. The charAt() method accesses an individual character by providing an index. String fullName = \"Tom Waits\"; char firstInitial = fullName.charAt(0); //'T' char lastInitial = fullName.charAt(4); //'W' If fullName.charAt(8) == 's', a conditional block can be executed."
Related Ideas
- How can strings be copied and their characters accessed in Java?ComputerScienceOne · Basics
- How can individual characters in a string be accessed safely?ComputerScienceOne · Basic Operations
- How can you compute a substring of a string?ComputerScienceOne · Arrays of Strings
- How does Java make working with strings easier?ComputerScienceOne · Basics
- How can strlen determine the length of a C string?ComputerScienceOne · String Library
- What are PHP strings and how should they be treated?ComputerScienceOne · Basics
- How can you create static strings with character arrays?ComputerScienceOne · Character Arrays
- How can you extract substrings from a string in PHP?ComputerScienceOne · Arrays of Strings