L le_toubib Active Member Licensed User Longtime User Jan 22, 2017 #1 hi all sorry for newbie qs does isnumber(0.5) return true ? and isnumber(.5)? is there a way to tell if a string is integer or isdecimal ? other than parsing or regex it ?
hi all sorry for newbie qs does isnumber(0.5) return true ? and isnumber(.5)? is there a way to tell if a string is integer or isdecimal ? other than parsing or regex it ?
ilan Expert Licensed User Longtime User Jan 22, 2017 #2 u can check if a number has decimal like this: B4X: Log(isDecimal(25.05)) '... Sub isDecimal(number As Float) As Boolean Return number Mod 1 = 0 End Sub EDIT: btw isNumber will only tell you if the selected string is a valid number. so you will get in both case true (25 or 25.05) Upvote 0
u can check if a number has decimal like this: B4X: Log(isDecimal(25.05)) '... Sub isDecimal(number As Float) As Boolean Return number Mod 1 = 0 End Sub EDIT: btw isNumber will only tell you if the selected string is a valid number. so you will get in both case true (25 or 25.05)