tufanv Expert Licensed User Longtime User Apr 4, 2016 #1 Hello, I want to checkif text1.text.cotains only numbers ( there wont be any charachter different than a number ) is it possible to do it with text.contains ? ty
Hello, I want to checkif text1.text.cotains only numbers ( there wont be any charachter different than a number ) is it possible to do it with text.contains ? ty
KMatle Expert Licensed User Longtime User Apr 4, 2016 #2 text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber Upvote 0
text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber
Descartex Well-Known Member Licensed User Longtime User Apr 4, 2016 #3 Hi, you should use a Matcher to see if there is any char not numeric. http://www.regular-expressions.info/ Upvote 0
Hi, you should use a Matcher to see if there is any char not numeric. http://www.regular-expressions.info/
tufanv Expert Licensed User Longtime User Apr 4, 2016 #4 KMatle said: text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber Click to expand... my users can enter numbers or strings into textfiled. I dont want to limit them to numbers only. I want to do stg if there are only numbers and do another thing if not. Maybe i can use the loop example. ty Upvote 0
KMatle said: text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber Click to expand... my users can enter numbers or strings into textfiled. I dont want to limit them to numbers only. I want to do stg if there are only numbers and do another thing if not. Maybe i can use the loop example. ty
tufanv Expert Licensed User Longtime User Apr 4, 2016 #5 KMatle said: text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber Click to expand... isnumber(text1.text) works for me . Thanks ! Upvote 0
KMatle said: text1.contains checks if a string is found in text1. If it's an edittext just Change the input_type to numbers so the user can only Input numbers (or decimal numbers if you like). Otherwise do a loop and check the characters in that string with isNumber Click to expand... isnumber(text1.text) works for me . Thanks !