Look for the given double value in list of numeric values.
Look for the given int value is in list of int values.
Look for the given text if can be found in list of text separated with separator.
string find_in_list( double dVal, const string & strList, char cSeparator = '|' )
int find_in_list( int nVal, const vector<int> & vn, bool bWasSortedAccending )
int find_in_list(LPCSTR lpcszVal, LPCSTR lpcszList, char cSeparator = '|', bool bCaseSensitive = true)
numeric string in the list if found, or an empty string if not.
index into vn if found, or -1 if not.
index if test can be found in text list, or -1 if not.
EX1
void find_in_list_ex1() { string strList = "1,2,3,3.4,4,4.23,5"; string str = find_in_list(3.4, strList, ','); out_str(str); }
EX2
void find_in_list_ex2() { int nVal = 3; vector<int> vnList = {1,2,3,4,5}; bool bWasSortedAccending = true; int ret = find_in_list(nVal, vnList, bWasSortedAccending); // should return 2, the index of nVal in vnList printf("ret is %d\n",ret); }
origin.h