Check and see if given string is in the list. The match can be partial, and case insensitive, is desired. The search can start from any index.
BOOL okutil_is_in_list( LPCSTR lpcszTest, StringArray * psaList, BOOL bCaseSensitive = false, BOOL bKeyPartialMatch = false, int * pnFound = NULL, int nStart = 0 )
Returns true if found.
EX1
void okutil_is_in_list_ex1() { vector<string> vsList = {"aaa", "bbb", "ccc", "ddd", "D", "eee", "fff"}; string strFind = "D"; //call with function defaults bool bIsInList = okutil_is_in_list( strFind, &vsList); //the search starts from 'aaa'. It finds "D" and returns true. //call again with following arguments bool bKeyCaseSensitive = false; bool bKeyPartialMatch = true; int nFirstIndexFound; int nStartOffset = 2; bIsInList = okutil_is_in_list( strFind, &vsList, bKeyCaseSensitive, bKeyPartialMatch, &nFirstIndexFound, nStartOffset); // this search begins with "ccc". It finds "ddd" to be a match since bKeyCaseSensitive = false and bKeyPartialMatch = true. // nFirstIndexFound is set to 3, and returns true. }
origin.h