StringReplace

Hi all,



I stick on using SysUtils.StringReplace in TScripterIDE.

I do not know how to deal with the TReplaceFlags.



This one tells me that rfPreplaceAll is not declared...

aString:=SysUtils.StringReplace(aString, 'a', 'b', [rfReplaceAll, rfIgnoreCase]);





Can someone help me with a few lines of sample-code ?



Thanks, Tom

You can just declare those constants:


Scripter.AddConstant('rfReplaceAll', Ord(rfReplaceAll));
Scripter.AddConstant('rfIgnoreCase, Ord(rfIgnoreCase));

and use it like this:
aString := StringReplace(aString, 'a', 'b', SetOf([rfReplaceAll, rfIgnoreCase]));

Hi Wagner,



my main-problem was, that I didn't know SetOf([]).

These are my very first steps with TScripter - and probably I did not read the manual close enough.



Anyhow - I finally got it work. Since I'm a lazy guy, I took this one...

aString := StringReplace(aString, 'a', 'b', SetOf([0, 1]));



Thanks a lot for your support.



Regards, Tom