Link to home
Start Free TrialLog in
Avatar of JohnSantaFe
JohnSantaFe

asked on

Check string for int and ascii

Is there an easy way to check if a string contains ONLY integers?
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another way, assuming you don't mind using 3rd party code is to use either thr PCRE or boost regular expression toolkits. You can then use a simple regular expression to parse the string in anyway you like. Whilst this may seem overkill, the power that comes with using regular expressions is well worth the little time it's take to (a) use how to use the toolkit and (b) learn how to write regular expressions. Both are pretty simple to learn but the pay-back is very worth it :)