mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: prevent infinite loop in $CharacterReplace
This commit is contained in:
@ -47,6 +47,10 @@
|
||||
:local ReplaceWith [ :tostr $3 ];
|
||||
:local Len [ :len $ReplaceFrom ];
|
||||
|
||||
:if ($ReplaceFrom = "") do={
|
||||
:return $String;
|
||||
}
|
||||
|
||||
:while ($String ~ $ReplaceFrom) do={
|
||||
:local Pos [ :find $String $ReplaceFrom ];
|
||||
:set String ([ :pick $String 0 $Pos ] . $ReplaceWith . [ :pick $String ($Pos + $Len) 999 ]);
|
||||
|
Reference in New Issue
Block a user