Filter characters from a string
-
Hello !
I am working on a client app that communicates with a device via ethernet over TCP.
I send it a string command and i get back a string response.Among the commands and answers, there are control characters and meta-codes. Those are the ASCII characters between 0x60 and 0x7f.
How can i chop every character within this range from my response string ?
thanks a lot.
-
Hello !
I am working on a client app that communicates with a device via ethernet over TCP.
I send it a string command and i get back a string response.Among the commands and answers, there are control characters and meta-codes. Those are the ASCII characters between 0x60 and 0x7f.
How can i chop every character within this range from my response string ?
thanks a lot.
@Marty said:
Among the commands and answers, there are control characters and meta-codes. Those are the ASCII characters between 0x60 and 0x7f.
How can i chop every character within this range from my response string ?
Brute force can help there. Since you know the ASCII range to exclude you can simply do it with an if statement. Also the good old C routines might help isalpha and fellows.
Alternative for more sophisticated stuff there is QRegExp or the newer version QRegularExpression.