C語言字符串匹配函數,保存有需要時可以用:
#include <stdio.h> #include <stdlib.h> #include <.h> #include <assert.h> #include <time.h> badShift[ goodPostfixLastPos( *pattern, _break(flag) if(flag){ break;} flag = len = postFix_len = len - postFix_position = initStart = pos - last_start = last_start = (postFix_position == pos) ?initStart: postFix_start = (;last_start>= && postFix_start<len;last_start++,postFix_start++ flag = (pattern[last_start] == _break(! (initStart >= initStart-- postFix_position++ postFix_len-- flag?last_start-:- *calc_goodPostfixShift( *pattern, * len = ( i=;i<len;i++ goodShift[i] = len - goodPostfixLastPos(pattern,i) - *clac_badcharShift( * pLen = (i = ; i < ; i++ *(badShift+i) = (pLen != *(badShift+(unsigned )*ptrn++) = -- BMSearch( *str, * len1 = len2 = ( i=len2 - ;i< start = pos_pattern = len2 - (;pos_pattern>=;pos_pattern--,start-- (str[start] != (pos_pattern < start + (pos_pattern == (len2 - i += i += goodShift[pos_pattern + - }