Best way to check if a character is alpha or numeric?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • If I do

    Code
    if val(mystring) > 0
    string is numeric


    This works for numbers 1-9 but not 0.

    How would I write a function that returns 'string is numeric' for '0' but 'string is not numeric for 'A'?

    I suppose I could do:

    but that's a bit complicated. Any better ideas?

    Please login to see this link.

  • Quote

    Does 'greater than or equal to' (>=) not work?

    Unfortunately val(string) returns 0 for an alpha character, so >= would identify 'A' as being equal to 0 and '0' as being equal to zero, therefore concluding all strings are a number, just equal to 0.

    I ended up using my method, but thanks for the info Popcorn, I didn't know Edit Object could do that.

    Please login to see this link.

  • Another pretty quick way could be:

    Lower$("my_string" ) = Upper$("my_string" )
    >>> is numeric

    Lower$("my_string" ) <> Upper$("my_string" )
    >>> is text


    won't work for special characters though... :(

    yours is probably quickest+most solid way,
    along with the editbox as Popcorn suggested

    a selection of my Fusion examples can be found Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!