Hi, I need to read a word in a string, without using tokens.
Consider word as any sequence of letters that are uppercase or lowercase.
The numbers or other characters are not part of any word, but they separate words as if they were blank spaces.
For example, if the input is:
hola+Amigos2323 ,buenos(((di12--ASSS
The words extracted will be hola,Amigos,buenos,di and ASSS.
I tried
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
void cuentaPalabras(string frases,int &words){
int l=0;
int longitud=frases.length();
do{
if(frases[l-1]>64 && frases[l-1]<122 && frases[l+1]>64 && frases[l+1]<122 && frases[l]<64 && frases[l]>122){
words++;
l++;
}
else
l++;
}while(l<longitud);
|
But doesnt works, any solution?