Previous: , Up: kmp   [Index]


29.6 Full sequence search

Function: %kmp-search item= item-ref text text-start text-past pattern pattern-start pattern-past

Search the selected subsequence of text for the selected subsequence of pattern. Return the index of the first value in text that matched the first value in the pattern.

This function is like %string-contains and %string-contains-ci, in facts those are implemented as:

(define (%string-contains text text-beg text-past
                          pattern pattern-beg pattern-past)
  (%kmp-search char=? string-ref
               text text-beg text-past
               pattern pattern-beg pattern-past))

(define (%string-contains-ci text text-beg text-past
                             pattern pattern-beg pattern-past)
  (%kmp-search char-ci=? string-ref
               text text-beg text-past
               pattern pattern-beg pattern-past))