Adobe ColdFusion 8

CCFXStringSet::GetIndexForString

Syntax

int CCFXStringSet::GetIndexForString(LPCSTR lpszString)

Description

Searches for a passed string. The search is case-insensitive.

Returns

If the string is found, its index within the string set is returned. If it is not found, the constant CFX_STRING_NOT_FOUND is returned.

Parameters

Parameter

Description

lpszString

String to search for

Example

The following example demonstrates a search for a string and throwing an exception if it is not found:

CCFXStringSet* pAttribs = pRequest->GetAttributeList() ;
     
    int iDestination =
            pAttribs->GetIndexForString("DESTINATION") ;
    if ( iDestination == CFX_STRING_NOT_FOUND )
    {
                        pRequest->ThrowException(
                        "DESTINATION attribute not found."
                        "The DESTINATION attribute is required "
                        "by this tag." ) ;
    }