t102_copy.pas 365 B

12345678910111213141516171819
  1. program t102_copy;
  2. { t102 -- the Copy string builtin: clipping at both ends and an empty result. }
  3. var
  4. S, T : string[20];
  5. begin
  6. S := 'abcdef';
  7. T := Copy (S, 2, 3);
  8. writeln (T);
  9. T := Copy (S, 1, 99);
  10. writeln (T);
  11. T := Copy (S, 0, 2);
  12. writeln (T);
  13. T := Copy (S, 10, 2);
  14. writeln ('[', T, ']');
  15. T := Copy (S, 3, 0);
  16. writeln ('[', T, ']')
  17. end.