tcpstr16.pp 465 B

123456789101112131415161718192021
  1. program tcpstr16;
  2. {$mode delphi}
  3. {$codepage cp1251}
  4. {$apptype console}
  5. type
  6. T866String = type AnsiString(866);
  7. T1251String = type AnsiString(1251);
  8. function Compare(const S1, S2: RawByteString): Boolean;
  9. begin
  10. Result :=
  11. (Length(S1) = Length(S2)) and
  12. (CompareByte(S1[1],S2[1],Length(S1))=0);
  13. end;
  14. begin
  15. if Compare(T866String('ïðèâåò'), 'ïðèâåò') then
  16. halt(1);
  17. if not Compare(AnsiString(T866String('ïðèâåò')), 'ïðèâåò') then
  18. halt(2);
  19. end.