AoFindString()

Updated: April 19, 2023

Find the setting associated with a given string

Synopsis:

#include <aoi.h>

const char *AoFindString(const char* const *strings, 
                         const char *name);

Arguments:

strings
An array of immutable strings to search. The strings must be in the format returned by AoGetStrings() (i.e., the expected format for addon strings).
name
The string you want to search for in the array. The string can be the key in a key-value pair that's separated by an equal sign (=), or it can be a key with no value.

Library:

libaoi.so

Description:

This function searches the given array of strings for a character sequence whose beginning matches the given search string (name) and is followed by a NULL-terminator or an equal sign (=).

If a NULL-terminator follows the string, the function returns a pointer to the NUL (\0) character (i.e., an empty string) to indicate that no setting is associated with the string. If an equal sign follows the string, the returned pointer points to the character following the equal sign, which is the beginning of the string's setting.

Sometimes, the setting for an addon string can itself be a list of individual strings; in this case, you can call AoSearchString() to check for the occurrence of a particular value within the string's setting.

If it doesn't find a character sequence matching the search string, the function returns a NULL pointer.

Returns:

A pointer to the character following the first occurrence of the search string if it's found, or NULL if it's not found.

Example:

An example of using AoFindString() to find the settings for the strings published by an addon through its Strings interface is given in the AoIterate() entry.

Classification:

QNX Neutrino