back to Table of Contents


FindBufFwd & FindBufRev (function)

These functions will search for the criteria, which were earlier associated with the find data specified by the given ID (see SetBufFind()). Depending on the called function the search will be performed in forward or reverse direction but in both cases starting at the current buffer position. If the criteria is found, then the found position is returned and it will also automatically become the new current buffer position. If the criteria is otherwise not found, then zero (0) is returned and the current buffer position remains unchanged. The returned position remains valid until you write or delete data in the respective buffer. Be also aware of (negative) error returns.

For a sequential search to find all occurrences of the criteria in the buffer, you simply call the same direction search function ever again until you get no more hits. Different from INSTR, you don't need to manually displace the start position by 1 byte for the next call to avoid finding the same occurrence again, as the buffer keeps track of the last found occurrence and will do this automatically as required.


SYNTAX:

found& = FindBufFwd& (buf$(), findID%, method%, treat%)
found& = FindBufRev& (buf$(), findID%, method%, treat%)

INPUTS:

buf$() (STRING array)

findID% (INTEGER)

method% (INTEGER)

treat% (INTEGER)


RESULT:

found& (LONG)


METHOD FLAGS:

SBF_FullData

SBF_Delimiter

SBF_InvDelimiter

TREATMENT FLAGS:

SBF_AsWritten

SBF_IgnoreCase


back to Table of Contents