Check and see if given string is in the list.
Check and see if given double value is in the vector.
bool is_in_list( LPCSTR lpcszName, const vector<string> & vsList, bool bCaseSensitive = false, int * pn = NULL )
bool is_in_list(vectorbase& vecList, double dVal)
returns true if lpcszName is found in vsList, otherwise false.
returns true if dVal is found in vector, otherwise false.
EX1
int is_in_list_ex1() { vector<string> vsPlaces = {"ShangHai","Shanghai","UK","LA","London","Pary"}; int iIndex; if(is_in_list("UK", vsPlaces,true,&iIndex)) printf("%d\n",iIndex);//Should print 2 since the index starts from 0 string strPlace = "ShangHai"; if(is_in_list(strPlace,vsPlaces,true,&iIndex)) printf("%d\n",iIndex);//Should print 0 since the index starts from 0 return 0; }
find_in_list
origin.h