Type : Checking?

how do i do a check to find out whether a users input into say a label.caption is an integer or not ? Is it the ASCII value for integers i need?

Comments

  • : how do i do a check to find out whether a users input into say a label.caption is an integer or not ? Is it the ASCII value for integers i need?
    :
    The easiest and most dirty way of doing this is using a try-except block:
    [code]
    try
    StrToInt(SomeString);
    except
    ShowMessage('SomeString isn''t an integer!');
    end;
    [/code]
    A better way is to iterate through the characters of the string and check if they are all between '0' and '9'.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion