Next: SRFI-13 Modification, Previous: SRFI-13 List/String Conversion, Up: SRFI-13
These procedures are called selectors, because they access information about the string or select pieces of a given string.
Additional selector procedures are documented in the Strings section
(see String Selection), like string-length or
string-ref.
string-copy is also available in core Guile, but this version
accepts additional start/end indices.
Return a freshly allocated copy of the string str. If given, start and end delimit the portion of str which is copied.
Like
substring, but the result may share memory with the argument str.
Copy the sequence of characters from index range [start, end) in string s to string target, beginning at index tstart. The characters are copied left-to-right or right-to-left as needed – the copy is guaranteed to work, even if target and s are the same string. It is an error if the copy operation runs off the end of the target string.
Return the n first characters of s.
Return all but the first n characters of s.
Take characters from start to end from the string s and return a new string, right-padded by the character chr to length len. If the resulting string is longer than len, it is truncated on the right.
Trim s by skipping over all characters on the left that satisfy the parameter char_pred:
- if it is the character ch, characters equal to ch are trimmed,
- if it is a procedure pred characters that satisfy pred are trimmed,
- if it is a character set, characters in that set are trimmed.
If called without a char_pred argument, all whitespace is trimmed.