Node:String Selection,
Next:String Modification,
Previous:List/String Conversion,
Up:Strings
21.4.5 String Selection
Portions of strings can be extracted by these procedures.
string-ref
delivers individual characters whereas
substring
can be used to extract substrings from longer strings.
string-length string
|
Scheme Procedure |
scm_string_length (string)
|
C Function |
Return the number of characters in string.
|
string-ref str k
|
Scheme Procedure |
scm_string_ref (str, k)
|
C Function |
Return character k of str using zero-origin
indexing. k must be a valid index of str.
|
string-copy str
|
Scheme Procedure |
scm_string_copy (str)
|
C Function |
Return a newly allocated copy of the given string.
|
substring str start [end]
|
Scheme Procedure |
scm_substring (str, start, end)
|
C Function |
Return a newly allocated string formed from the characters
of str beginning with index start (inclusive) and
ending with index end (exclusive).
str must be a string, start and end must be
exact integers satisfying:
0 <= start <= end <= (string-length str).
|