tcpstrconcat4.pp 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {$mode delphiunicode}
  2. type
  3. tstr850 = type ansistring(850);
  4. tstr866 = type ansistring(866);
  5. tstr65001 = type ansistring(65001);
  6. procedure test;
  7. var
  8. s1: tstr850;
  9. s2: tstr866;
  10. s3: tstr65001;
  11. r: rawbytestring;
  12. begin
  13. s1:='a';
  14. s2:='b';
  15. s3:='c';
  16. r:='d';
  17. r:=s1+s2;
  18. writeln(stringcodepage(r));
  19. if (stringcodepage(r)<>0) and
  20. (stringcodepage(r)<>defaultsystemcodepage) then
  21. halt(1);
  22. setcodepage(r,850);
  23. r:=s1+s2;
  24. writeln(stringcodepage(r));
  25. if (stringcodepage(r)<>0) and
  26. (stringcodepage(r)<>defaultsystemcodepage) then
  27. halt(2);
  28. setcodepage(r,CP_ASCII);
  29. r:=s1+s2;
  30. writeln(stringcodepage(r));
  31. if (stringcodepage(r)<>0) and
  32. (stringcodepage(r)<>defaultsystemcodepage) then
  33. halt(3);
  34. r:=s1+s1;
  35. writeln(stringcodepage(r));
  36. if (stringcodepage(r)<>stringcodepage(s1)) then
  37. halt(4);
  38. r:=s2+s2;
  39. writeln(stringcodepage(r));
  40. if (stringcodepage(r)<>stringcodepage(s2)) then
  41. halt(5);
  42. end;
  43. begin
  44. test;
  45. end.