Finding the Length of a String
The length of a string can be determined using the string-length function. It accepts a single string and returns its length as an integer. Whitespace is significant, so leading and trailing whitespace characters are counted. Table 17-5 shows some examples.
Table 17-5. Examples of the string-length function
|
Example |
Return value |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access