CString str = "Hello world!"; char strFind[] = "ow"; // Find the characters 'o' and 'w' int nIndex = str.FindOneOf(strFind); // Returns 4
CString str = "The quick brown fox jumps over the lazy dog."; TCHAR strFind[] = _T("AEIOUaeiou"); // Find any vowel int nIndex = str.FindOneOf(strFind); // Returns 2In this example, we define a CString variable named 'str' and initialize it with the sentence "The quick brown fox jumps over the lazy dog.". We create a TCHAR array named 'strFind' with all the vowel characters in uppercase and lowercase. We call the FindOneOf function on 'str' with 'strFind' as the argument, which returns the index of the first occurrence of any vowel in 'str'. The result is '2', which corresponds to the index of the first 'e' in 'The quick brown fox jumps over the lazy dog.'. The package library for CString FindOneOf is the MFC (Microsoft Foundation Class) library in C++.