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

Filter the string s, retaining only those characters that satisfy the char_pred argument. If the argument is a procedure, it is applied to each character as a predicate, if it is a character, it is tested for equality and if it is a character set, it is tested for membership.

— Scheme Procedure: string-delete s char_pred [start [end]]

Filter the string s, retaining only those characters that do not satisfy the char_pred argument. If the argument is a procedure, it is applied to each character as a predicate, if it is a character, it is tested for equality and if it is a character set, it is tested for membership.