Menu

Check input on beeing numeric

Anonymous
2015-12-21
2016-02-14
  • Anonymous

    Anonymous - 2015-12-21

    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

     
    • Markus Hoffmann

      Markus Hoffmann - 2016-01-05

      In INPUT,, a komma is used to split the input into two variables. Maybe you want to use LINEINPUT instead.

       
      • Anonymous

        Anonymous - 2016-02-14

        Thanks a lot, this works properly!!!
        With LINEINPUT I am able to check for all characters.

        Cheers
        Gerhard

         

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.