mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-03 06:34:27 +02:00
global-functions: $CharacterReplace: do not limit string length
I've tried something like this to update a device: / system script set source=[ $CharacterReplace [ get global-config-overlay source ] "GlobalConfigVersion 10" "GlobalConfigVersion 11" ] global-config-overlay; This broke with global-config-overlay longer than 999 characters. So makes sure there is no limit for string length.
This commit is contained in:
parent
0c705d5311
commit
03af7d6d9c
1 changed files with 1 additions and 2 deletions
|
@ -64,7 +64,6 @@
|
|||
:local String [ :tostr $1 ];
|
||||
:local ReplaceFrom [ :tostr $2 ];
|
||||
:local ReplaceWith [ :tostr $3 ];
|
||||
:local Len [ :len $ReplaceFrom ];
|
||||
:local Return "";
|
||||
|
||||
:if ($ReplaceFrom = "") do={
|
||||
|
@ -74,7 +73,7 @@
|
|||
:while ([ :typeof [ :find $String $ReplaceFrom ] ] != "nil") do={
|
||||
:local Pos [ :find $String $ReplaceFrom ];
|
||||
:set Return ($Return . [ :pick $String 0 $Pos ] . $ReplaceWith);
|
||||
:set String [ :pick $String ($Pos + $Len) 999 ];
|
||||
:set String [ :pick $String ($Pos + [ :len $ReplaceFrom ]) [ :len $String ] ];
|
||||
}
|
||||
|
||||
:return ($Return . $String);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue