get_key_value_parameter()

get_key_value_parameter()#

Extracts a key-value pair from a given string, where the key and value are separated by an ‘=’ character. The function modifies the input string by inserting null terminators and returns a pointer to the extracted value.

Prototype

char *get_key_value_parameter(
    char *s,
    char **key,
    char **save_ptr
);

Parameters

Key

Type

Description

s

char *

The input string containing the key-value pair. This string is modified in-place.

key

char **

Pointer to store the extracted key. The key is null-terminated.

save_ptr

char **

Pointer to store the remaining part of the string after the key-value pair.


Return Value

A pointer to the extracted value, or NULL if no valid key-value pair is found.

Notes

The function expects the input string to be formatted as ‘key=value’ or ‘key=”value”’. The input string is modified by inserting null terminators to separate the key and value.

Prototype

// Not applicable in JS

Prototype

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