Internet Direct (Indy)
Home
PreviousUpNext
TIdBuffer.IndexOf Method (TIdBytes, Integer)

Determines the index position of a value in the buffer.

Pascal
function IndexOf(
    const ABytes: TIdBytes; 
    AStartPos: Integer = 0
): Integer; overload;
Parameters 
Description 
ABytes 
Byte values to locate in the buffer.
 
AStartPos 
Offset into the buffer to begin looking for the specified value. Default value is 0. 

Integer - Zero-based offset of the desired value in the buffer, or -1 when the value is not found.

IndexOf is an overloaded Integer function used to determine the index position where the value in ABytes occurs in the buffer. 

ABytes represents the byte values to locate in the internal storage for the buffer. 

AStartPos indicates the inital offset in the buffer to begin looking for a value that matches ABytes. AStartPos is a zero-based offset into the byte values for the buffer. 

The return value for the method will contain -1 when ABytes cannot be located in the internal storage for the buffer, or the zero-based offset of the desired value in the buffer. 

IndexOf will raise exceptions if ABytes is empty or the value in AStartPos is outside the allowable range starting at zero and ending at the Size of the buffer minus 1.

Exceptions 
Description 
Raised with the message RSBufferMissingTerminator if the search bytes are empty.
Raised with the message RSBufferInvalidStartPos if the starting position for the search is outside the range indicated by 0 and Size -1. 
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.