B4J Question String contain NO NUMBERS characters

petr4ppc

Active Member
Licensed User
Dear friends, please,

is here some simple soulution how to recognize not number characters in string?

For example if he string is "1254as5748"
Here si "as" inside the string....I can not use this string...

I need use only string with numbers....

Or the best solution is
1) get length of string
2) check each character if it is number = the character contain 1,2,3,4,5,6,7,8,9,0
3) delete or use this string

Thank you very much
Best regards
p4ppc
 

rwblinn

Well-Known Member
Licensed User
Hi,

use IsNumber, like
B4X:
Dim s As String = "1254as5748"
Log(s & " is a number " & IsNumber(s)) ' False
Dim s As String = "12545748"
Log(s & " is a number " & IsNumber(s)) ' True
 
Top