home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / mailpro / str2inu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-08-23  |  417 b   |  26 lines

  1. unit Str2InU;
  2.  
  3. interface
  4. function Str2Int(X: string; var Err: integer): integer;
  5.  
  6. implementation
  7.  
  8. function Str2Int;
  9. var Continue:     boolean;
  10.     I,
  11.     N:            integer;
  12. begin
  13. Continue := true;
  14. for I := ord(x[0]) downto 1 do
  15.     if not (X[I] in ['0'..'9','.','-']) then
  16.        delete(X,I,1);
  17. N := 0;
  18. if ord(x[0]) < 1 then
  19.    Err := -1
  20.   else
  21.    val(X,N,Err);
  22. Str2Int := N;
  23. end;
  24.  
  25. end.
  26.