- Home /
Question by
TurboHermit · Dec 02, 2012 at 11:16 PM ·
textfieldcharacterscontains
Check if string contains letters
I have a text field in which people can put an answer to a mathematical question. How can I check if the answer contains letters? Is there an if statement for this?
Comment
Best Answer
Answer by Eric5h5 · Dec 03, 2012 at 12:03 AM
It would be better to prevent the user from entering letters at all; see my answer here.
Thanks this works perfectly! I do have a follow up question though, I allow people to type numbers and a . Can I prevent them from typing . more than one time?
Yes, check the input string for a . and prevent the . from being a valid input character if it's present in the string.