mIRC Home    About    Download    Register    News    Help

Print Thread
#178645 13/06/07 11:24 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
if I had something like

Code:
var %x = some very long string

var %r = $replace($1-, bb, %x)
%r = $replace($1-, tu, %x)
%r = $replace($1-, pr, %x)
%r = $replace($1-, bv, %x)



how could i make that smaller? all im doing is repeating code for replacing, what about regsubex? any ideas guys

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
/help $replace

Read it thoroughly and you'll have your answer.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can have multiple replaces in a single $replace.

$replace(this is fun,this,that,fun,not) would make:

this is fun become that is not


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Not only could you do it with one $replace, but the way you have it now you will be editing the un-edited text each time. You should replace $1- with %r on the last 3...

Code:
var %x = some very long string
var %r = $replace($1-, bb, %x)
var %r = $replace(%r, tu, %x)
var %r = $replace(%r, pr, %x)
var %r = $replace(%r, bv, %x)


... or use /tokenize instead of %r


Link Copied to Clipboard