idx_in_list()#
The function idx_in_list() searches for a string in a list of strings and returns its index if found, or -1 if not found.
Prototype
int idx_in_list(
const char **list,
const char *str,
BOOL ignore_case
);
Parameters
Key |
Type |
Description |
|---|---|---|
|
|
A null-terminated array of string pointers to search within. |
|
|
The string to search for in the list. |
|
|
If |
Return Value
Returns the index of str in list if found, or -1 if not found.
Notes
The function iterates through the list and compares each element 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