Next: , Previous: , Up: strings   [Index]


25.12 Prefixes and suffixes

Function: %string-prefix-length str1 start1 past1 str2 start2 past2
Function: %string-prefix-length-ci str1 start1 past1 str2 start2 past2
Macro: string-prefix-length S1 S2
Macro: string-prefix-length-ci S1 S2

Return the length of the longest common prefix of the two substrings. This is equivalent to the “mismatch index” for the strings (modulo the start index offsets).

Function: %string-suffix-length str1 start1 past1 str2 start2 past2
Function: %string-suffix-length-ci str1 start1 past1 str2 start2 past2
Macro: string-suffix-length S1 S2
Macro: string-suffix-length-ci S1 S2

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

Function: %string-prefix? str1 start1 past1 str2 start2 past2
Function: %string-prefix-ci? str1 start1 past1 str2 start2 past2
Macro: string-prefix? S1 S2
Macro: string-prefix-ci? S1 S2

Return #t if the selected substring of str1 is a prefix of the selected substring of str2, otherwise return #f. Notice that the empty string is a prefix of every string.

Function: %string-suffix? str1 start1 past1 str2 start2 past2
Function: %string-suffix-ci? str1 start1 past1 str2 start2 past2
Macro: string-suffix? S1 S2
Macro: string-suffix-ci? S1 S2

Return #t if the selected substring of str1 is a suffix of the selected substring of str2, otherwise return #f. Notice that the empty string is not a suffix of every string.