Strings as Set of Characters
Let's practice few methods that access or iterate over a string.
We'll cover the following
Identifying a particular character
You may think of a string as an array of characters. Each character is identified by a number called an index, just as it does for an array. The same golden rules apply:
- The index of the first character in a string is , not
- The highest index number is the string’s length minus
Let’s have a look at the illustration below:
Get hands-on with 1400+ tech skills courses.