I am using X11 Basic on Andoid.
I am working on a safe way to determine if a variable is numeric or string I've got some useful hints in other parts of this forum using the len and val? - function. This works properly, but I found an exception:
If the string contains a KOMMA, this is ignored.
input "input =" (n$) str_len=len(n$) print str_len print "asc_",asc(n$)
You will see, that len counts up to the KOMMA, the rest is trunced. As well the asy delivers 0 instead of 44 (for KOMMA)
So it is hard to determine an invalid input like 1,234 (instead of 1.234)
Is there any idea how to manage this?
Thanks for any help previously
Gerhard
You seem to have CSS turned off. Please don't fill out this field.
Anonymous
In INPUT,, a komma is used to split the input into two variables. Maybe you want to use LINEINPUT instead.
Thanks a lot, this works properly!!! With LINEINPUT I am able to check for all characters.
Cheers Gerhard
View and moderate all "Open Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I am using X11 Basic on Andoid.
I am working on a safe way to determine if a variable is numeric or string
I've got some useful hints in other parts of this forum using the len and val? - function. This works properly, but I found an exception:
If the string contains a KOMMA, this is ignored.
input "input =" (n$)
str_len=len(n$)
print str_len
print "asc_",asc(n$)
You will see, that len counts up to the KOMMA, the rest is trunced.
As well the asy delivers 0 instead of 44 (for KOMMA)
So it is hard to determine an invalid input like 1,234 (instead of 1.234)
Is there any idea how to manage this?
Thanks for any help previously
Gerhard
In INPUT,, a komma is used to split the input into two variables. Maybe you want to use LINEINPUT instead.
View and moderate all "Open Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Thanks a lot, this works properly!!!
With LINEINPUT I am able to check for all characters.
Cheers
Gerhard