⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strs.3

📁 harvest是一个下载html网页得机器人
💻 3
字号:
.\"(c) Copyright 1992, 1993 by Panagiotis Tsirigotis.\"All rights reserved.  The file named COPYRIGHT specifies the terms .\"and conditions for redistribution..\".\" strs.3,v 1.1.1.1 1994/04/26 19:08:12 hardy Exp.TH STRS 3X "10 January 1993".SH NAMEstrs_setup, strs_match, strs_done, strs_search - string matching functions.SH SYNOPSIS.LP.nf.ft B#include "str.h".LP.ft Bstrs_h strs_setup( flags, pattern )int flags ;char *pattern ;.LP.ft Bchar *strs_match( handle, str, len )strs_h handle ;char *str ;int len ;.LP.ft Bvoid strs_done( handle )strs_h handle ;.LP.ft Bchar *strs_search( flags, str, len, pattern )int flags ;char *str ;int len ;char *pattern ;.SH DESCRIPTION.LPThese functions perform string matching. They have been designed withthe assumption that one needs to find a certain pattern in a set ofstrings. It is also possible to use them to find if a pattern occursin a specific string..LP.B strs_setup()is used to specify the pattern to look for. It returns a.I handlewhich is used in subsequent string matching operations againstthe specified.I pattern.The.I flagsargument has two parts: a search method and generic flags.The available search methods include the following algorithms:.RS.TP 15.SB STRS_BFbrute force algorithm (also called naive in the literature). .TP.SB STRS_RKRabin-Karp algorithm (probabilistic)..TP.SB STRS_KMPKnuth-Morris-Pratt algorithm..TP.SB STRS_SBMSimple Boyer-Moore (uses only the last occurrence heuristic)..TP.SB STRS_BMHThis is the Boyer-Moore algorithm using the last occurrence heuristicas modified by Horspool (this is faster than the simple Boyer-Moore)..RE.LPThe default algorithm is the brute force method.In practice, the fastest algorithm is theBoyer-Moore-Horspool one..LPThe flags that can be specified include:.RS.TP 15.SB STRS_NOMALLOCdo not allocate space for the pattern. This can be specified ifthe pattern space will be available during the matching phase(i.e. do not use this flag if the pattern space was malloc'ed andyou free it before doing any matching)..TP.SB STRS_IGNCASEperform case-insensitive string matching(the default is case-sensitive matching)..RE.LP.B strs_match()tries to match the string specified by.I stragainst the pattern identified by.I handle.Since the length of the string is given by the.I lenargument the string does not need to be NUL-terminated..B strs_done()should be invoked after all matching against the pattern identified by.I handleis done..LP.B strs_search()is equivalent to:.LP.PD .1v.nf.RSh = strs_setup( flags, pattern ) ;p = strs_match( h, str, len ) ;strs_done( h ) ;return( p ) ;.RE.PD.SH "RETURN VALUES".LP.B strs_setup()returns a search handle on success or.SM NULLon failure..LP.B strs_match()and.B strs_search()return a pointer to the first occurrence of the pattern in the string or.SM NULLif the pattern does not occur in the string..SH "SEE ALSO"Donald E. Knuth, James H. Morris, Vaughan R. Pratt.Fast pattern matching in strings.SIAM Journal on Computing, 6(2):323-350, 1977..LPRichard M. Karp, Michael O. Rabin.Efficient randomized pattern-matching algorithms.Technical Report TR-31-81,Aiken Computation Laboratory, Harvard University, 1981..LPRobert S. Boyer, J. Strother Moore.A fast string-searching algorithm.Communications of the ACM, 20(10):762-772, 1977..LPN. Horspool.Practical fast searching in strings.Software - Practice and Experience, 10:501-506, 1980..LPThomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest.Introduction to Algorithms.McGraw-Hill 1990.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -