CGXControl::FindStringInChoiceList
virtual int FindStringInChoiceList(CString& sMatch, LPCTSTR pszEdit, LPCTSTR pszChoiceList, BOOL bExact);
sMatch
A reference to a string where the method stores the entry in the choice list which matches the given criteria.
pszEdit
A pointer to a zero-terminated string which holds the text to be searched for.
pszChoiceList
A pointer to a zero-terminated string which holds the choice list.
bExact
Specifies whether the entry has to be matched exactly or if it is sufficient that pszEdit is only the prefix of an entry.
Return Value
Returns the zero-based index of the entry that matches the search criteria. If no entry could be found, the return value will be -1.
Remarks
Searches the choice list string for a specific entry and returns the zero-based index of the entry that matches the search criteria.
For example, if you call
CString sMatch;
int nIndex = FindStringInChoiceList(sMatch, "t", "one\ntwo\nthree\n", FALSE);
nIndex will receive 1 and sMatch will be “two”.
If you call
int nIndex = FindStringInChoiceList(sMatch, "t", "one\ntwo\nthree\n", TRUE);
nIndex will receive -1.
If you call
int nIndex = FindStringInChoiceList(sMatch, "THREE", "one\ntwo\nthree\n", FALSE);
nIndex will receive 2 and sMatch will be “three”.