% limb manual
% byte_chr(3)
% limb 0.1.0
% 2023-07-24
# NAME
byte_chr, byte_rchr, byte_in - locate a byte within a byte array
# SYNOPSIS
#include <limb/bytestr.h>
```pre hl
size_t byte_chr(const char *<em>haystack</em>, size_t <em>hlen</em>, int <em>c</em>)
size_t byte_rchr(const char *<em>haystack</em>, size_t <em>hlen</em>, int <em>c</em>)
size_t byte_in(const char *haystack, size_t hlen, const char *sep, size_t slen)
```
# DESCRIPTION
The `byte_chr`() function looks for the first occurrence of byte `c` in the
byte array `haystack` of length `hlen`.
The `byte_rchr`() function looks for the last occurrence of a byte `c` in the
byte array `haystack` of length `hlen`.
The `byte_in`() function looks for the first occurrence of any of the `slen`
bytes in `sep` in the array `haystack` of length `hlen`.
# RETURN VALUE
The `byte_chr`() and `byte_rchr`() functions return the offset of the first or
last occurrence of byte `c` in the byte array `haystack`, respectively, when
found. Otherwise they return `hlen`.
The `byte_in`() function returns the offset of the first occurrence of any of
the `slen` bytes in `sep` in the array `haystack`, or `hlen` when not found.