ex56.pp 580 B

12345678910111213141516171819202122232425262728
  1. Program Example56;
  2. { This program demonstrates the AnsiStrLComp function }
  3. Uses sysutils;
  4. Procedure TestIt (S1,S2 : Pchar; L : longint);
  5. Var R : Longint;
  6. begin
  7. R:=AnsiStrLComp(S1,S2,L);
  8. Write ('First ',L,' characters of "',S1,'" are ');
  9. If R<0 then
  10. write ('less than ')
  11. else If R=0 then
  12. Write ('equal to ')
  13. else
  14. Write ('larger than ');
  15. Writeln ('those of "',S2,'"');
  16. end;
  17. Begin
  18. Testit('One string','One smaller string',255);
  19. Testit('One string','One String',4);
  20. Testit('One string','1 string',0);
  21. Testit('One string','One string.',9);
  22. End.