alias breplacestr {
;noop $breplacestr(&input,searchbyte1 searchbyte2,replacebytes)
;noop $breplacestr(&input,195 169,226 128) replace the sequence of bytes 195 169 (the é character) by the sequence 226 128 (the • character)
;noop $breplacestr(&input,195 169,32) replace é with a space
var %a 1,%p,%l $numtok($2,32),%m $numtok($3,32)
while ($bfind($1,%a,$2)) {
bcopy &breplacestr -1 $1 %a $calc($v1 - %a)
bset &breplacestr -1 $3
%a = $calc($v1 + %l)
}
if ($bvar(&breplacestr,0)) {
if (%a <= $bvar($1,0)) bcopy &breplacestr -1 $1 %a -1
bunset $1
bcopy $1 1 &breplacestr 1 -1
bunset &breplacestr
}
}