1program tisdigit2; 2 3{$ifdef FPC} 4 {$mode objfpc} 5 {$H+} 6 {$PACKENUM 1} 7{$endif fpc} 8 9{$ifndef FPC} 10 {$APPTYPE CONSOLE} 11{$endif} 12 13uses 14 SysUtils, 15 character; 16 17{$ifndef FPC} 18 type UnicodeChar = WideChar; 19{$endif} 20 21procedure DoError(ACode : Integer); overload; 22begin 23 WriteLn('Error #',ACode); 24 Halt(Acode); 25end; 26 27procedure DoError(ACode : Integer; ACodePoint : Integer); overload; 28begin 29 WriteLn('Error #',ACode,' ; CodePoint = ',IntToHex(ACodePoint,4)); 30 Halt(Acode); 31end; 32 33procedure DoError(ACode : Integer; ACodePoint : UnicodeChar); overload; 34begin 35 WriteLn('Error #',ACode,' ; CodePoint = ',IntToHex(Ord(ACodePoint),4)); 36 Halt(Acode); 37end; 38 39var 40 e, i , k: Integer; 41 strPrefix, uc : UnicodeString; 42 locCharPos : Integer; 43begin 44 strPrefix := '012345AZERT '; 45 locCharPos := Length(strPrefix) + 1; 46 e := 1; 47 for i := Ord('0') to Ord('9') do begin 48 uc := strPrefix + UnicodeChar(i) + strPrefix; 49 if not TCharacter.IsDigit(uc,locCharPos) then 50 DoError(e,uc[locCharPos]); 51 end; 52 53 Inc(e); 54 for i := Low(Word) to High(Word) do begin 55 uc := strPrefix + UnicodeChar(i) + strPrefix; 56 if (TCharacter.GetUnicodeCategory(uc,locCharPos) = TUnicodeCategory.ucDecimalNumber) then begin 57 if not TCharacter.IsDigit(uc,locCharPos) then 58 DoError(e,uc[locCharPos]); 59 end; 60 end; 61 62 Inc(e); 63 for i := Ord('a') to Ord('z') do begin 64 uc := strPrefix + UnicodeChar(i) + strPrefix; 65 if TCharacter.IsDigit(uc,locCharPos) then 66 DoError(e,uc[locCharPos]); 67 end; 68 69 WriteLn('ok'); 70end. 71