testure.pp 421 B

1234567891011121314151617181920212223
  1. program testure;
  2. {$mode objfpc}
  3. {$H+}
  4. {$CODEPAGE UTF8}
  5. uses
  6. cwstring, Classes, SysUtils, uregexpr;
  7. var
  8. r: TRegExpr;
  9. s, s2: UTF8String;
  10. begin
  11. r:= TRegExpr.create;
  12. r.Expression:= '.+';
  13. s:= 'pro про';
  14. s2:= r.Replace(s, '\U$0', true);
  15. Writeln(Format('Upcase of "%s" -> "%s"', [s, s2]));
  16. s:= 'PRO ПРО';
  17. s2:= r.Replace(s, '\L$0', true);
  18. Writeln(Format('Lowcase of "%s" -> "%s"', [s, s2]));
  19. end.