Hi, I've looked around in the forum, but i can't figure out how to do it correctly.
I have several GTextFields, and i use them to input numbers, which are then sent on a serial protocol one-character-per-time, so it is convenient for me to have them as Strings.
Now I would like to avoid sending characters other than numbers (0 to 9), so which is the best way to find out characters other than numbers in a String?
I was thinking about converting the string to a number, and see if it return an error, but I'm quite sure there must be a better way..
any idea?
Thanks, Davide.
I have several GTextFields, and i use them to input numbers, which are then sent on a serial protocol one-character-per-time, so it is convenient for me to have them as Strings.
Now I would like to avoid sending characters other than numbers (0 to 9), so which is the best way to find out characters other than numbers in a String?
I was thinking about converting the string to a number, and see if it return an error, but I'm quite sure there must be a better way..
any idea?
Thanks, Davide.
1