Text::FindChar
Defined in:
Searches for a particular byte value in a string.
TSText.h
Prototype
int32 FindChar(const char *text, uint32 k);
int32 FindChar(const char *text, uint32 k, int32 max);
Parameters
text |
A pointer to a null-terminated character string. |
k |
An 8-bit bytes value to search for. |
max |
The maximum number of bytes to search. |
Description
The FindChar
function searches the string specified by the text
parameter for the byte value given by the k
parameter. If the max
parameter is included, then it specifies the maximum number of bytes to search from the beginning of the string. Otherwise, the search continues until a zero byte is encountered. The string does not need to be null-terminated if the max
parameter is included, but the search will still end if a zero byte is encountered before max
bytes have been searched.If the character given by
k
is found, then the byte position within the string of the first occurrence is returned. If it is not found, then the return value is −1.
See Also