int CCFXStringSet::GetIndexForString(LPCSTR lpszString)
Searches for a passed string. The search is case-insensitive.
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.
Parameter | Description |
---|---|
lpszString |
String to search for |
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." ) ;
}