tcpstrconcat.pp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {$APPTYPE CONSOLE}
  2. {$ifdef go32v2}
  3. {$define USE_INTERNAL_UNICODE}
  4. {$endif}
  5. {$ifdef USE_INTERNAL_UNICODE}
  6. {$define USE_FPWIDESTRING_UNIT}
  7. {$define USE_UNICODEDUCET_UNIT}
  8. {$define USE_CPALL_UNIT}
  9. {$endif}
  10. uses
  11. {$ifdef unix}
  12. {$ifdef darwin}iosxwstr{$else}cwstring{$endif},
  13. {$endif unix}
  14. {$ifdef USE_UNICODEDUCET_UNIT}
  15. unicodeducet,
  16. {$endif}
  17. {$ifdef USE_FPWIDESTRING_UNIT}
  18. fpwidestring,
  19. {$endif}
  20. {$ifdef USE_CPALL_UNIT}
  21. cpall,
  22. {$endif}
  23. sysutils;
  24. type
  25. ts866 = type AnsiString(866);
  26. var
  27. a, b, c : ts866;
  28. begin
  29. a := 'al';
  30. b := 'b2';
  31. c := '';
  32. //without "DestS" in the array
  33. c := a + b;
  34. if (StringCodePage(c) <> 866) then
  35. halt(1);
  36. //with empty "DestS" in the array
  37. c := '';
  38. c := c + a ;
  39. if (StringCodePage(c) <> 866) then
  40. halt(2);
  41. //with "DestS" in the array at the start
  42. c := c + a ;
  43. if (StringCodePage(c) <> 866) then
  44. halt(3);
  45. //with "DestS" in the array, not at the start
  46. c := a + c;
  47. if (StringCodePage(c) <> 866) then
  48. halt(4);
  49. WriteLn('ok');
  50. end.