mIRC Home    About    Download    Register    News    Help

Print Thread
replacing string with 2 other different strings #96687 04/09/04 11:07 AM
Joined: Nov 2003
Posts: 9
D
dmmaster Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Nov 2003
Posts: 9
I am making an addon and i bumped into the following problem:
for example i have the following string

This is an example <string> and i <string> think it is a cool <string>

The problem is:
i want to replace the <string> on the follwing pattern
string1
if (string1 is already placed) { string2 } // i give this for example how i want the strings to be placed.
if (string2 is already placed) { string1}

it is something like if you have a CTRL+B code and you want to change it to html with <b> </b>
to check if it is open and if it is close it.

The only way i could think of was to loop in the tokens but it has 2 main problems.
first it would be rather slow
second: if it comes <string>blabla<string> it would put string1/2 on both

any other ideas how to do it ?

Re: replacing string with 2 other different strings #96688 04/09/04 12:23 PM
Joined: Aug 2003
Posts: 314
S
Sigh Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
I already answered you on mircscripts.org's message board. You should give it some time before posting elsewhere, at least check for responses before doing so since it leads to other people answering unnecessarily when you may have already been given a working solution

Re: replacing string with 2 other different strings #96689 04/09/04 12:25 PM
Joined: Mar 2004
Posts: 130
T
tsoglanos Offline
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
I am not 100% sure i understend what your asking for but i think somthing like this would make the job

Code:
 
//echo -a $replace(string,st,$iif($left(string,1) == s,newstring,oldstring))
 

I holp u Understend what i mean,.