1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- program ttolower;
- {$ifdef FPC}
- {$mode objfpc}
- {$H+}
- {$PACKENUM 1}
- {$endif fpc}
- {$ifndef FPC}
- {$APPTYPE CONSOLE}
- {$endif}
-
- uses
- SysUtils,
- character;
-
- {$ifndef FPC}
- type UnicodeChar = WideChar;
- {$endif}
- procedure DoError(ACode : Integer); overload;
- begin
- WriteLn('Error #',ACode);
- Halt(Acode);
- end;
-
- procedure DoError(ACode : Integer; ACodePoint : Integer); overload;
- begin
- WriteLn('Error #',ACode,' ; CodePoint = ',IntToHex(ACodePoint,4));
- Halt(Acode);
- end;
-
- procedure DoError(ACode : Integer; ACodePoint : UnicodeChar); overload;
- begin
- WriteLn('Error #',ACode,' ; CodePoint = ',IntToHex(Ord(ACodePoint),4));
- Halt(Acode);
- end;
- var
- e, i, j : Integer;
- uc : UnicodeChar;
- begin
- e := 1;
- for i := Ord('a') to Ord('z') do begin
- uc := UnicodeChar(i);
- if (TCharacter.ToLower(uc) <> uc) then
- DoError(e,i);
- end;
- Inc(e);
- for i := Ord('0') to Ord('9') do begin
- uc := UnicodeChar(i);
- if (TCharacter.ToLower(uc) <> uc) then
- DoError(e,i);
- end;
-
- Inc(e);
- j := Ord('a');
- for i := Ord('A') to Ord('Z') do begin
- uc := UnicodeChar(i);
- if (TCharacter.ToLower(uc) <> UnicodeChar(j)) then
- DoError(e,i);
- Inc(j);
- end;
-
- Inc(e);
- for i := Low(Word) to High(Word) do begin
- uc := UnicodeChar(i);
- if (TCharacter.GetUnicodeCategory(uc) = TUnicodeCategory.ucLowercaseLetter) then begin
- if (TCharacter.ToLower(uc) <> uc) then
- DoError(e,uc);
- end;
- end;
- WriteLn('ok');
- end.
|