Next: , Previous: SRFI-13 Prefixes/Suffixes, Up: SRFI-13


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 good [start [end]]

Search through the string s from left to right, returning the index of the first occurence of a character satisfying good, which must be one of:

character ch
The character is ch.
predicate (procedure) p
The character satisfies p.
character set cset
The character is in cset.

— Scheme Procedure: string-skip s skip [start [end]]
— Scheme Procedure: string-skip-right s skip [start [end]]

Search through the string s from left to right, returning the index of the first occurence of a character which satisfies skip, which must be one of:

character ch
The character is not ch.
predicate (procedure) p
The character does not satisfy p.
character set cset
The character is not in cset.

— Scheme Procedure: string-count s good [start [end]]

Return the count of the number of characters in the string s which satisfies good, which must be one of:

character ch
Count if the character is ch.
predicate (procedure) p
Count if the character satisfies p.
character set cset
Count if the character is in cset.

— 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 #f.