6.6.5.8 String Searching

Scheme Procedure: string-index s char_pred [start [end]]
C Function: scm_string_index (s, char_pred, start, end)

Search through the string s from left to right, returning the index of the first 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.

Return #f if no match is found.

Scheme Procedure: string-rindex s char_pred [start [end]]
C Function: scm_string_rindex (s, char_pred, start, end)

Search through the string s from right to left, returning the index of the 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 if char_pred is a character set.

Return #f if no match is found.

Scheme Procedure: string-prefix-length s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_prefix_length (s1, s2, start1, end1, start2, end2)

Return the length of the longest common prefix of the two strings.

Scheme Procedure: string-prefix-length-ci s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_prefix_length_ci (s1, s2, start1, end1, start2, end2)

Return the length of the longest common prefix of the two strings, ignoring character case.

Scheme Procedure: string-suffix-length s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_suffix_length (s1, s2, start1, end1, start2, end2)

Return the length of the longest common suffix of the two strings.

Scheme Procedure: string-suffix-length-ci s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_suffix_length_ci (s1, s2, start1, end1, start2, end2)

Return the length of the longest common suffix of the two strings, ignoring character case.

Scheme Procedure: string-prefix? s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_prefix_p (s1, s2, start1, end1, start2, end2)

Is s1 a prefix of s2?

Scheme Procedure: string-prefix-ci? s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_prefix_ci_p (s1, s2, start1, end1, start2, end2)

Is s1 a prefix of s2, ignoring character case?

Scheme Procedure: string-suffix? s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_suffix_p (s1, s2, start1, end1, start2, end2)

Is s1 a suffix of s2?

Scheme Procedure: string-suffix-ci? s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_string_suffix_ci_p (s1, s2, start1, end1, start2, end2)

Is s1 a suffix of s2, ignoring character case?

Scheme Procedure: string-index-right s char_pred [start [end]]
C Function: scm_string_index_right (s, char_pred, start, end)

Search through the string s from right to left, returning the index of the 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 if char_pred is a character set.

Return #f if no match is found.

Scheme Procedure: string-skip s char_pred [start [end]]
C Function: scm_string_skip (s, char_pred, start, end)

Search through the string s from left to right, returning the index of the first 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-skip-right s char_pred [start [end]]
C Function: scm_string_skip_right (s, char_pred, start, end)

Search through the string s from right to left, returning the index of the 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]]
C Function: scm_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]]]]
C Function: scm_string_contains (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.

Scheme Procedure: string-contains-ci s1 s2 [start1 [end1 [start2 [end2]]]]
C Function: scm_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. Character comparison is done case-insensitively.