Boyer-Moore-Horspool text searching (
Pascal version
available)
char *search( pat, text, n ) char *pat, *text; int n; { int i, j, k, m, skip[MAXCHAR]; m = strlen(pat); if( m==0 ) return( text ); for( k=0; k
=0 && text[i] == pat[j]; j-- ) i--; if( j == (-1) ) return( text+i+1 ); } return( NULL ); }
C
source (713b.srch.c)
Pascal
source (713b.srch.p)
©
Addison-Wesley
Publishing Co. Inc.