Guile Reference Manual
39.11.9 Searching
Use these procedures to find out whether a string contains a given
character or a given substring, or a character from a set of characters.
- Scheme Procedure: string-index s char_pred [start end]
-
- Scheme Procedure: string-index-right s char_pred [start end]
- Search through the string s from left to right (right to left),
returning the index of the first (last) occurrence of a character which
-
equals char_pred, if it is character,
-
satisfies the predicate char_pred, if it is a
procedure,
-
is in the set char_pred, if it is a character set.
- Scheme Procedure: string-skip s char_pred [start end]
-
- Scheme Procedure: string-skip-right s char_pred [start end]
- Search through the string s from left to right (right to left),
returning the index of the first (last) occurrence of a character which
-
does not equal char_pred, if it is character,
-
does not satisfy the predicate char_pred, if it is
a procedure.
-
is not in the set if char_pred is a character set.
- Scheme Procedure: string-count s char_pred [start end]
- Return the count of the number of characters in the string
s which
-
equals char_pred, if it is character,
-
satisfies the predicate char_pred, if it is a procedure.
-
is in the set char_pred, if it is a character set.
- Scheme Procedure: string-contains s1 s2 [start1 end1 start2 end2]
-
- Scheme Procedure: string-contains-ci s1 s2 [start1 end1 start2 end2]
- Does string s1 contain string s2? Return the index
in s1 where s2 occurs as a substring, or false.
The optional start/end indices restrict the operation to the
indicated substrings.
string-contains-ci is the case-insensitive variant.