How to check in Delphi: numeric or string ?


[ Post Followup ] [ Delphi Forum ] [ Delphi Tutorials -- by DelphiLand ]

Posted by Feier Vlad on September 29, 2003 at 21:39:20:

In Reply to: How to check in Delphi for numeric or string ? posted by beginner on September 29, 2003 at 11:42:31:

You should try to convert the string (wich is written in the Edit-textbox anyway, even if it is a number or anything else) to a number, so you do like this:
s - your string (textbox's string)
nr - the number

write this:

val(s,nr,c);

c is a Delphi error code - if the string cannot be converted to a number, c is not 0, else c is 0 (c=0);






[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]