ttolower2.pp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. program ttolower2;
  2. {$ifdef FPC}
  3. {$mode objfpc}
  4. {$H+}
  5. {$PACKENUM 1}
  6. {$endif fpc}
  7. {$ifndef FPC}
  8. {$APPTYPE CONSOLE}
  9. {$endif}
  10. uses
  11. SysUtils,
  12. character;
  13. {$ifndef FPC}
  14. type UnicodeChar = WideChar;
  15. {$endif}
  16. procedure DoError(ACode : Integer); overload;
  17. begin
  18. WriteLn('Error #',ACode);
  19. Halt(Acode);
  20. end;
  21. procedure DoError(ACode : Integer; ACodePoint : Integer); overload;
  22. begin
  23. WriteLn('Error #',ACode,' ; CodePoint = ',IntToHex(ACodePoint,4));
  24. Halt(Acode);
  25. end;
  26. procedure DoError(ACode : Integer; ACodePoint : UnicodeString); overload;
  27. begin
  28. WriteLn('Error #',ACode,' ; String = ',ACodePoint);
  29. Halt(Acode);
  30. end;
  31. var
  32. e, i, j : Integer;
  33. uc, s, s2 : UnicodeString;
  34. begin
  35. e := 1;
  36. s := 'azerty';
  37. if (TCharacter.ToLower(s) <> s) then begin
  38. WriteLn(s);
  39. s2 := TCharacter.ToLower(s);
  40. WriteLn('"',s2,'"');
  41. DoError(e,s2);
  42. end;
  43. Inc(e);
  44. s := '0123456789';
  45. if (TCharacter.ToLower(s) <> s) then
  46. DoError(e,s);
  47. Inc(e);
  48. s := 'AZERTY'; s2:= 'azerty';
  49. if (TCharacter.ToLower(s) <> s2) then begin
  50. WriteLn(s);
  51. s2 := TCharacter.ToLower(s);
  52. WriteLn('"',s2,'"');
  53. DoError(e,s2);
  54. end;
  55. s := 'AzERty';
  56. if (TCharacter.ToLower(s) <> s2) then begin
  57. WriteLn(s);
  58. s2 := TCharacter.ToLower(s);
  59. WriteLn('"',s2,'"');
  60. DoError(e,s2);
  61. end;
  62. WriteLn('ok');
  63. end.