| 1234567891011121314151617181920212223242526 |
- program t96_valint;
- { t96 -- Val(string, integer, error). CALC.INC's Help converts the line count
- string into EndOfFile with Val; the error position must be 0 on a valid
- string and the 1-based position of the first bad character otherwise. On
- error the destination is unchanged (TPSRC2 valerr). }
- var
- S : string[10];
- I, E : integer;
- begin
- S := '42';
- I := 0;
- Val (S, I, E);
- writeln (I, ' ', E);
- S := '-7';
- Val (S, I, E);
- writeln (I, ' ', E);
- S := '12x';
- I := 0;
- Val (S, I, E);
- writeln (I, ' ', E);
- S := '';
- Val (S, I, E);
- writeln (I, ' ', E)
- end.
|