standard.C.string.memchr

memchr is available since version 1.0.

Prototype:

string memchr(string buf, string c, integer count)

Parameters

buf
the string buffer
c
Character to look for
count
Number of characters to check.

Description:

Finds characters in a buffer. Looks for the first occurrence of c in the first count bytes of buf. It stops when it finds c or when it has checked the first count bytes.

Return value:

If successful, returns a pointer to the first location of c in buf. Otherwise it returns NULL.