possible $bfind bug - 30/01/05 07:02 AM
I was trying to write an alias that is equivalent to $numtok, but for &binvars; however, I got an infinite loop due to what I consider to be a bug: if you $bfind for a char that happens to appear at the end of a &bvar, with the starting point beyond the end of that bvar, it returns the position of that last char.. Hard to explain in words, so I'll try doing it with code:
Since the &bvar only contains one character, the above should return 0 or $null or something. Instead, it returns 1, or whatever the position of the last 97 happened to be. It doesn't matter what N value is specified, so
returns 3. Note that if the &bvar ends with anything other than the character you are searching for, 0 is returned, which is as I expect.
returns 0.
mirc 6.16/winXP+SP2
Code:
bset &test 1 97 echo -a $bfind(&test,2,97)
Since the &bvar only contains one character, the above should return 0 or $null or something. Instead, it returns 1, or whatever the position of the last 97 happened to be. It doesn't matter what N value is specified, so
Code:
bset -t &test 1 aaa echo -a $bfind(&test,923,97)
returns 3. Note that if the &bvar ends with anything other than the character you are searching for, 0 is returned, which is as I expect.
Code:
bset -t &test 1 aaab echo -a $bfind(&test,923,97)
returns 0.
mirc 6.16/winXP+SP2