![]() |
![]() |
![]() |
![]() |
![]() |
|
Once you have a string, you can determine its length using the
length method. For example, if codeString has a string
assigned to it, you can obtain the length of the string as follows:
*-- Variable with a string assignment | | *-- length method v v ---------- -------- codeString.length()
Note the contrast between arrays and vectors: to obtain the length of an
array, you examine the length instance variable, rather than calling
a method; to obtain the length of a vector, you deploy the size
method.