[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_SetIFind

Overview

Locate the index of a field case-insensitively

Syntax

    int Ns_SetIFind(
    Ns_Set *set,
    char *key
    );

Description

The Ns_SetIFind function is the case-insensitive counterpart of the Ns_SetFind function. It returns the index of the first field whose key name matches the given key case-insensitively. The index is in C array order, i.e., 0 is the index of the first field. If no fields are found, Ns_SetIFind returns -1. If more than one field in the set has the same key name, Ns_SetIFind returns just the first field index.

Examples

    Ns_Set *aSet;
    int index;
    
    aSet = Ns_SetCreate("");
    Ns_SetPut(aSet, "Foo", "foovalue");
    Ns_SetPut(aSet, "Bar", "barvalue");
    index = Ns_SetIFind(aSet, "foo"); /* case insensitive search*/
    if (index == -1) {
    	Ns_Log(Warning, "set key foo not found");
    } else {
    	Ns_Log(Notice, "Value for Foo is %s", 
    			Ns_SetGet(aSet, "ooo"));
    }
    Ns_SetFree(aSet);

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.