Previous: SRFI-13 Miscellaneous, Up: SRFI-13


39.11.15 Filtering/Deleting

Filtering means to remove all characters from a string which do not match a given criteria, deleting means the opposite.

— Scheme Procedure: string-filter s keep [start [end]]

Filter the string s, returning a new string which retains only those characters that satisfy keep, 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-delete s omit [start [end]]

Filter the string s, returning a new string which excludes those characters that satisfy omit, 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.