kw_find_str_in_list()

kw_find_str_in_list()#

kw_find_str_in_list() searches for a string in a JSON list and returns its index if found, otherwise returns -1.

Prototype

int kw_find_str_in_list(
    hgobj      gobj,
    json_t *   kw_list,
    const char *str
);

Parameters

Key

Type

Description

gobj

hgobj

A handle to the gobj instance, used for logging errors.

kw_list

json_t *

A JSON array to search within.

str

const char *

The string to search for in the JSON list.


Return Value

Returns the index of the string in the list if found, otherwise returns -1.

Notes

The function only searches for exact string matches within the JSON array.

Prototype

// Not applicable in JS

Prototype

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