mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: prevent infinite loop
This commit is contained in:
parent
04b7b1f3b5
commit
26ccf41298
1 changed files with 4 additions and 2 deletions
|
@ -44,6 +44,7 @@
|
|||
:local ReplaceFrom [ :tostr $2 ];
|
||||
:local ReplaceWith [ :tostr $3 ];
|
||||
:local Len [ :len $ReplaceFrom ];
|
||||
:local Return "";
|
||||
|
||||
:if ($ReplaceFrom = "") do={
|
||||
:return $String;
|
||||
|
@ -51,10 +52,11 @@
|
|||
|
||||
:while ($String ~ $ReplaceFrom) do={
|
||||
:local Pos [ :find $String $ReplaceFrom ];
|
||||
:set String ([ :pick $String 0 $Pos ] . $ReplaceWith . [ :pick $String ($Pos + $Len) 999 ]);
|
||||
:set Return ($Return . [ :pick $String 0 $Pos ] . $ReplaceWith);
|
||||
:set String [ :pick $String ($Pos + $Len) 999 ];
|
||||
}
|
||||
|
||||
:return $String;
|
||||
:return ($Return . $String);
|
||||
}
|
||||
|
||||
# check and import required certificates
|
||||
|
|
Loading…
Reference in a new issue