Using other locales, an alphabetic character is a character for which isupper or islower would return true, or another character explicitly considered alphabetic by the locale (in this case, the character cannot be iscntrl, isdigit, ispunct or isspace).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
/* isalpha example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
int i=0;
char str[]="C++";
while (str[i])
{
if (isalpha(str[i])) printf ("character %c is alphabetic\n",str[i]);
else printf ("character %c is not alphabetic\n",str[i]);
i++;
}
return 0;
}
|
Based on this description, I'm not sure if using this would work, because wouldn't a space be a non letter?
because spaces are okay. now, that I'm thinking about it ...characters should be permitted but ignored.....
ex.
./piglatin "I'm going to the store."
./piglatin "It's 8 o'clock."
This sentence should be allowed to be translated. thereby allowing characters.
but what about a string off nonsensical characters or string of numbers.
Is it possible to errorcheck for that whille still allowing examples like above?