#include#include using namespace std; int main() { wstring str = L"Hello, World!"; wstring vowels = L"AEIOUaeiou"; size_t pos = str.find_first_of(vowels); if (pos != wstring::npos) { wcout << L"The first vowel is found at position " << pos << endl; } else { wcout << L"No vowel is found." << endl; } return 0; }
#includeThis example finds the first occurrence of any digit in a given string and outputs its position. If no digit is found, it prints a message. Package library: This function is part of the C++ standard library, which is included in all major C++ compilers. No external package or library is needed.#include using namespace std; int main() { wstring str = L"Hello, 123!"; size_t pos = str.find_first_of(L"0123456789"); if (pos != wstring::npos) { wcout << L"The first digit is found at position " << pos << endl; } else { wcout << L"No digit is found." << endl; } return 0; }