mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-23 04:14:27 +02:00
global-functions: add $CharacterReplace
This commit is contained in:
parent
4c61849483
commit
fc2547c137
1 changed files with 15 additions and 0 deletions
|
@ -40,6 +40,21 @@
|
||||||
:return $Return;
|
:return $Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# character replace
|
||||||
|
:global CharacterReplace do={
|
||||||
|
:local String [ :tostr $1 ];
|
||||||
|
:local ReplaceFrom [ :tostr $2 ];
|
||||||
|
:local ReplaceWith [ :tostr $3 ];
|
||||||
|
:local Len [ :len $ReplaceFrom ];
|
||||||
|
|
||||||
|
:while ($String ~ $ReplaceFrom) do={
|
||||||
|
:local Pos [ :find $String $ReplaceFrom ];
|
||||||
|
:set String ([ :pick $String 0 $Pos ] . $ReplaceWith . [ :pick $String ($Pos + $Len) 999 ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
:return $String;
|
||||||
|
}
|
||||||
|
|
||||||
# check and import required certificates
|
# check and import required certificates
|
||||||
:global CertificateAvailable do={
|
:global CertificateAvailable do={
|
||||||
:local CommonName [ :tostr $1 ];
|
:local CommonName [ :tostr $1 ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue