User Guide
CCFXStringSet class 767
Returns
Returns the number of strings contained in the string set.
Example
The following example demonstrates using GetCount with CCFXStringSet::GetString to
iterate over a string set and write the contents of the list back to the user:
int nNumItems = pStringSet->GetCount() ;
for ( int i=1; i<=nNumItems; i++ )
{
pRequest->Write( pStringSet->GetString( i ) ) ;
pRequest->Write( "<BR>" ) ;
}
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
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." ) ;
}
CCFXStringSet::GetString
Syntax
LPCSTR CCFXStringSet::GetString(int iIndex)
Description
Retrieves the string located at the passed index (index values are 1-based).
Parameter Description
lpszString String to search for