tcase38.pp 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. { comparsion of one-symbol strings in ranges }
  2. {$H-}
  3. var
  4. my_str: string;
  5. my_str_wide: widestring;
  6. my_str_ansi: ansistring;
  7. my_str_uni: unicodestring;
  8. i: integer;
  9. begin
  10. my_str := 'c';
  11. my_str_wide := 'c';
  12. my_str_ansi := 'c';
  13. my_str_uni := 'c';
  14. i := -1;
  15. case my_str of
  16. 'a'..'b': i := 1;
  17. 'c'..'d': i := 2;
  18. else i := 0;
  19. end;
  20. if (i <> 2) then begin
  21. writeln('Error');
  22. Halt(1);
  23. end;
  24. case my_str_wide of
  25. 'a'..'b': i := 1;
  26. 'c'..'d': i := 2;
  27. else i := 0;
  28. end;
  29. if (i <> 2) then begin
  30. writeln('Error');
  31. Halt(1);
  32. end;
  33. case my_str_ansi of
  34. 'a'..'b': i := 1;
  35. 'c'..'d': i := 2;
  36. else i := 0;
  37. end;
  38. if (i <> 2) then begin
  39. writeln('Error');
  40. Halt(1);
  41. end;
  42. case my_str_uni of
  43. 'a'..'b': i := 1;
  44. 'c'..'d': i := 2;
  45. else i := 0;
  46. end;
  47. if (i <> 2) then begin
  48. writeln('Error');
  49. Halt(1);
  50. end;
  51. end.