strnchrn

March 26, 2020 Contributors

Name

strnchrn — Searches a string for the first occurence of any of a set of characters

Synopsis

#include "util.h"

| char * **strnchrn** ( | str, |   |
|   | nstr, |   |
|   | chars, |   |
|   | nchars); |   |

const char * <var class="pdparam">str</var>;
int <var class="pdparam">nstr</var>;
const char * <var class="pdparam">chars</var>;
int <var class="pdparam">nchars</var>;

Description

Searches a string for the first occurence of any of a set of characters

Searches nstr chars starting at str for any of the nchars characters that are in chars. It will go past a NUL character in str.

Parameters

str

The string to search.

nstr

The number of characters to search.

chars

The characters to search for.

nchars

The number of characters in chars.

Return Values

Returns a pointer to the first matching character or NULL if there is no match.

Threading

It is legal to call this function in any thread.

See Also

string_init_type