mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-10 01:54:29 +02:00
global-functions: prevent infinite loop in $CharacterReplace
This commit is contained in:
parent
6a48c8b5e7
commit
db2c4fbf39
1 changed files with 4 additions and 0 deletions
|
@ -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 ]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue