SRL Archive - Help

Replacing Characters?


Mat

2012-03-17 19:17:50

How can I replace A-Z with out having a huge list of Replace's?
any idea?
Mat

bg5

2012-03-17 20:01:44

I don't get it, what exactly you want to replace?

E: if you want to replace any capital letter then you can use

ReplaceRegExpr('[A-Z]',InputString,Replacement,TRUE );

example :
program new;
var
s :string ;
begin
s:='AbCd54%6464LKP';
s :=ReplaceRegExpr('[A-Z]',s,' +ReplaceWith+ ',TRUE );
writeln(s);
end.

 +ReplaceWith+ b +ReplaceWith+ d54%6464 +ReplaceWith+  +ReplaceWith+  +ReplaceWith+ 

Coh3n

2012-03-17 20:04:31

Use a loop to go through each letter, checking if it's in a given string.

Mat

2012-03-17 20:31:50

Thanks Begin, also how can I remove all the lines? as it now has a huge amounts of enters down, I tried ' ' and it doesn't work? any ideas <3
Mat

bg5

2012-03-17 20:36:05

From: Mat
Thanks Begin, also how can I remove all the lines? as it now has a huge amounts of enters down, I tried ' ' and it doesn't work? any ideas <3
Mat


Can you post example?

Mat

2012-03-17 20:39:47

Here:

##







All the enters I can't seem to remove them.

bg5

2012-03-17 20:57:36

You can search for carriage return ( ASCII code #13#10) :

program new;
var
s :string ;
begin
s:='AbCd54%6464L'+#13#10+'nextLine'+#13#10+'dsdsd'+#13#10+'fdsfs';
writeln(s);
s:=ReplaceRegExpr('\x0D\x0A',s,'{++}',TRUE );
writeln('NewString:');
writeln(s);
end.

Mat

2012-03-17 21:09:00

Thanks Man working great<3
+Rep <3
Mat