so basically I have some input possibilities for the user where should only numbers be accepted, otherwise the user will be alerted his input was incorrect.
the input is considered a String when I read it out using a callback. now I want to check whether the string(which SHOULD contain numbers) actually DOES ONLY contain numbers, but I didnt find a solution implemented already. i tried
theString isInteger
-is never true for the string
theString asNumber
- ignores letters, but I want to have a clear output wether letters are included in the string or not
theString isNumber
- always false
In Squeak and Pharo, you have the message #isAllDigits
that does exactly what you want:
'1233248539487523' isAllDigits "--> true"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With