str_in_list()

str_in_list()#

The function str_in_list() checks if a given string exists within a list of strings, with an option to perform a case-insensitive comparison.

Prototype

BOOL str_in_list(
    const char **list,
    const char *str,
    BOOL ignore_case
);

Parameters

Key

Type

Description

list

const char **

A null-terminated array of string pointers representing the list to search.

str

const char *

The string to search for within the list.

ignore_case

BOOL

If TRUE, the comparison is case-insensitive; otherwise, it is case-sensitive.


Return Value

Returns TRUE if the string is found in the list, otherwise returns FALSE.

Notes

The function iterates through the list and compares each entry with str using either strcmp() or strcasecmp() based on the ignore_case flag.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples