Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Finds the first occurrence of a specific character in a string, up to a maximum number of characters.

Files

lib_str.h/lib_str.c

Prototype

Arguments

pstr

Pointer to the string to search for the specified character.

len_max

Maximum number of string characters to search.

srch_char

Character to search for in the string.

Returned Value

Pointer to first occurrence of character in string, if no errors;

Pointer to NULL, otherwise.

Required Configuration

None.

Notes / Warnings

String buffer not modified.

String search terminates if string pointer points to or overlaps the NULL address.

Ideally, Str_Char_N()’s len_max argument would be the last argument in this function’s argument list for consistency with all other custom string library functions. However, the len_max argument is sequentially ordered as the second argument to comply with most standard library’s strnchr() argument list.

Example Usage

  • No labels