mIRC Homepage
Posted By: quizer /breplace 2 replace binary string. - 05/09/03 04:45 PM
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)
Posted By: qwerty Re: /breplace 2 replace binary string. - 05/09/03 05:14 PM
I agree. Although I imagined the implementation different, enabling /breplace to work with strings would be very nice.
Posted By: Raccoon Re: /breplace 2 replace binary string. - 05/09/03 10:40 PM
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.
Posted By: quizer Re: /breplace 2 replace binary string. - 05/09/03 10:48 PM
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.
Posted By: Rich Re: /breplace 2 replace binary string. - 08/09/03 06:44 PM
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.
© mIRC Discussion Forums