Hi,
I am trying to check for valid Polish characters using the locale version of isalpha. I have the following test code which uses a string of valid Polish diacritic characters. My issue is that the isalpha function is rejecting 2 of the characters, but they are valid Polish characters. Any suggestions!
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
// isalpha example (C++)
#include <iostream>
#include <string>
#include <locale>
#include <time.h>
using namespace std;
int main( )
{
locale loc( "polish" );
string str="ACELNOSZ+ĽĆĘŁŃÓŚŹŻ+";
for ( string::iterator it=str.begin( ); it != str.end( ); ++it )
{
if ( isalpha( *it, loc ) )
{
cout << "character '" << *it << "' is alphabetic\n";
}
else
{
cout << "character '" << *it << "' is not alphabetic\n";
}
}
return 0;
}
|
This is my output:
character 'A' is alphabetic
character 'C' is alphabetic
character 'E' is alphabetic
character 'L' is alphabetic
character 'N' is alphabetic
character 'O' is alphabetic
character 'S' is alphabetic
character 'Z' is alphabetic
character '+' is not alphabetic
character 'Ą' is alphabetic
character 'Ć' is alphabetic
character 'Ę' is alphabetic
character 'Ł' is alphabetic
character 'Ń' is alphabetic
character 'Ó' is alphabetic
character 'Ś' is not alphabetic
character 'Ź' is not alphabetic
character 'Ż' is alphabetic
character '+' is not alphabetic
Any suggestions etc would be apreciated.