RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
StrUtils.SearchBuf Function

Locates a substring within a text buffer.

Pascal
function SearchBuf(Buf: PAnsiChar; BufLen: Integer; SelStart: Integer; SelLength: Integer; SearchString: AnsiString; Options: TStringSearchOptions = [soDown]): PAnsiChar; overload;
function SearchBuf(Buf: PWideChar; BufLen: Integer; SelStart: Integer; SelLength: Integer; SearchString: UnicodeString; Options: TStringSearchOptions = [soDown]): PWideChar; overload;
C++
PAnsiChar SearchBuf(PAnsiChar Buf, int BufLen, int SelStart, int SelLength, AnsiString SearchString, TStringSearchOptions Options = [soDown]);
PWideChar SearchBuf(PWideChar Buf, int BufLen, int SelStart, int SelLength, UnicodeString SearchString, TStringSearchOptions Options = [soDown]);

Call SearchBuf to search for a specified search string within a text buffer.  

Buf is the text buffer to search. 

BufLen is the length, in bytes, of Buf. 

SelStart is the first character of the search when Options indicates a backward search (does not include soDown). The first character in Buf has position 0. 

SelLength is the number of characters after SelStart that the search begins when Options indicates a forward search (includes soDown).  

SearchString is the string to find in Buf. 

Options determines whether the search runs forward (soDown) or backward from SelStart or SelStart+SelLength, whether the search is case sensitive (soMatchCase), and whether the matching string must be a whole word (soWholeWord). 

If SearchBuf finds a match, it returns a pointer to the first character of the matching string in Buf. If it does not find a match, SearchBuf returns nil (Delphi) or NULL (C++). 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!