kwid_match_nid()

kwid_match_nid()#

Checks if the given id with a limited size exists in the JSON list, dictionary, or string ids. The comparison is performed up to max_id_size characters.

Prototype

BOOL kwid_match_nid(
    hgobj    gobj,
    json_t  *ids,
    const char *id,
    int      max_id_size
);

Parameters

Key

Type

Description

gobj

hgobj

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

ids

json_t *

A JSON object, array, or string containing the IDs to check against.

id

const char *

The ID to search for within ids.

max_id_size

int

The maximum number of characters to compare in the id.


Return Value

Returns TRUE if the id (up to max_id_size characters) is found in ids, otherwise returns FALSE.

Notes

If ids is an empty object or array, the function returns TRUE. The function supports searching in JSON objects, arrays, and strings.

Prototype

// Not applicable in JS

Prototype

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