mIRC Home    About    Download    Register    News    Help

Print Thread
/breplace 2 replace binary string. #47446 05/09/03 04:45 PM
Joined: May 2003
Posts: 32
Q
quizer Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 32
original :
/breplace &binVar oldvalue newvalue [oldvalue newvalue...]
example: /breplace &binVar 250 247 228 227


suggestion: support 4:
1. /breplace &binVar 111.108.100 110,101,119 13 13.10 *
format:
2. /breplace &binvar (&oldString|%variable|text) (&newString|%variable|text)
3. /breplace [ -t ] &binVar oldTextString newTextString (-t will force threating numbers as plain text.)

example 1 should replace any appearance of 'old' in &binVar to 'new' and replaces carriage return character with the whole 'carriage return, line feed' string.

I know it can b scripted, I already scripted it, I used 1 variable, and three /bcopy and 1 /bset. what about making the mIRC do it automaticly without scripting?
I am using version 6.0, if newer versions support this feature, please delete this post.
sorry 4 my poor English, or my bad formulation.

* (111 108 100 == old), (110 101 119 == new)

Re: /breplace 2 replace binary string. #47447 05/09/03 05:14 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I agree. Although I imagined the implementation different, enabling /breplace to work with strings would be very nice.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: /breplace 2 replace binary string. #47448 05/09/03 10:40 PM
Joined: Feb 2003
Posts: 2,800
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,800
The only problem is, this would make /breplace slightly slower, especially if it supported replacing two strings of different sizes. Whenever you get into splicing smaller and larger substrings into a memory address, you basically have to $left() $+ %var $+ $mid() (in mirc-terms).

Perhaps a seperate function could be added for this, or some flag to preserve the present faster method.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: /breplace 2 replace binary string. #47449 05/09/03 10:48 PM
Joined: May 2003
Posts: 32
Q
quizer Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 32
Quote:
or some flag to preserve the present faster method


or just detection (single if) if it requirs length change.

I really don't like when things should b written without a clear purpose.

Re: /breplace 2 replace binary string. #47450 08/09/03 06:44 PM
Joined: Dec 2002
Posts: 117
R
Rich Offline
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
It can't be just
/breplace -t &bvar <oldtext> <newtext>
that would mess up when one of the strings contains spaces, so it would have to be something like
$breplace(&bvar,<oldtext>,<newtext>) (return the number of replacements or something like that)
or
/breplace &bvar &oldtext &newtext

Or some other neat solution I haven't thought of.


$input(Me like stars, You too?)