| string-length(3scm) | Scheme Programmer's Manual | string-length(3scm) |
NAME
string-length - the length of a string
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs base)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS
SYNOPSIS
(string-length string)
DESCRIPTION
Returns, as an exact integer object, the number of elements in string. The length of a string is fixed.
IMPLEMENTATION NOTES
All extant implementations use fixnums to represent string lengths, but this is not required.
RETURN VALUES
Returns a single value which is the length of the string.
EXAMPLES
(string-length "ABC")
=> 3
APPLICATION USAGE
The string-length procedure often appears in code that decodes or encodes data in some protocol or file format or that formats or parses strings. Sometimes an alternative is to use higher-order procedures (string-for-each(3scm), string-map(3scm)) or string ports (open-input-string(3scm), open-output-string(3scm)).
COMPATIBILITY
Apart from error handling, this procedure is the same in all Scheme reports.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its domain.
- R7RS
- The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
SEE ALSO
make-string(3scm), string-ref(3scm), string-for-each(3scm), string-map(3scm), open-input-string(3scm).
STANDARDS
R4RS, IEEE Scheme, R5RS, R6RS, R7RS
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2021-01-03 |