Breplace » History » Version 5
Per Amundsen, 02/15/2023 11:09 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | */breplace <&binvar> <oldvalue> <newvalue> [oldvalue newvalue...]* |
||
| 4 | |||
| 5 | 4 | Per Amundsen | Replaces all matching "ASCII":http://www.asciitable.com/ values in &binvar with new values. |
| 6 | 1 | Per Amundsen | |
| 7 | 3 | Per Amundsen | Multiple values can be replaced by adding more old/new parameters. |
| 8 | 2 | Per Amundsen | |
| 9 | 1 | Per Amundsen | *Parameters* |
| 10 | |||
| 11 | 5 | Per Amundsen | table(ktable). |
| 12 | |*Parameter*|*Description*| |
||
| 13 | | <&binvar> | The &binvar to modify. | |
||
| 14 | | <oldvalue> | "ASCII":http://www.asciitable.com/ value to replace. | |
||
| 15 | | <newvalue> | "ASCII":http://www.asciitable.com/ value to insert. | |
||
| 16 | 1 | Per Amundsen | |
| 17 | *Example* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | alias example { |
||
| 21 | ;Create a binary variable set it to "Hello World" |
||
| 22 | bset -t &Example 1 Hello World |
||
| 23 | |||
| 24 | ;Replace e (ASCII value 101) with 3 (ASCII value 51) |
||
| 25 | breplace &Example 101 51 |
||
| 26 | |||
| 27 | ;Echo our new string |
||
| 28 | echo -a $bvar(&Example,1,$bvar(&Example,0)).text |
||
| 29 | } |
||
| 30 | </pre> |