check string for numbers
Posted on 2004-09-28
I have a written a DLL which returns strings and integers from string. I am having a problem whereby if the string does not contain a valid number the real type conversion fails. What I need is a if else statement that checks there is a valid number.
Function lenofcall(S1,S2 : String) :Real;
Result := (StrToFloat(copy(S1,1,2))*60)+(StrToFloat(copy(S1,4,2)));
for instance the following text would give a result of 129
S1 := '01:59'
S1 := '----' or any other non number text,
then I want the result to give a result of '0'