1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// isalpha example (C++)
#include <iostream> // std::cout
#include <string> // std::string
#include <locale> // std::locale, std::isalpha
int main ()
{
std::locale loc;
std::string str="C++";
for (std::string::iterator it=str.begin(); it!=str.end(); ++it)
{
if (std::isalpha(*it,loc))
std::cout << "character " << *it << " is alphabetic\n";
else
std::cout << "character " << *it << " is not alphabetic\n";
}
return 0;
}
|