1 {=== Return only the numeric value of a string ===}2 function ValNumericDef(const sNum:string;const iDef:Integer=0):Integer;
3 var iLoop : Integer;
4 sWork : string;
5 begin6 Result := 0;
7 sWork := '';
8 if Length(sNum)=0 then Exit;
9 for iLoop:=1 to Length(sNum) dobegin10 if (Ord(sNum[iLoop])>=48) and (Ord(sNum[iLoop])<= 57) then11 sWork:=sWork+sNum[iLoop];
12 end;
13 Result := StrToIntDef(sWork,iDef);
14 end;
15 //---------------------------------------------------------------------//