limb 0.2.0

2024-01-09

byte_chr(3)
limb manual
byte_chr(3)

NAME

byte_chr, byte_rchr, byte_in - locate a byte within a byte array

SYNOPSIS

#include <limb/bytestr.h>
size_t byte_chr(const char *haystack, size_t hlen, int c)
size_t byte_rchr(const char *haystack, size_t hlen, int c)
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.

limb 0.1.0
2023-07-24
byte_chr(3)