mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-06-01 16:22:38 +00:00
global-functions: add ToLower function
This commit is contained in:
parent
cd4052ba6b
commit
9ba1dc8347
1 changed files with 19 additions and 0 deletions
|
|
@ -81,6 +81,7 @@
|
||||||
:global SendNotification2;
|
:global SendNotification2;
|
||||||
:global SymbolByUnicodeName;
|
:global SymbolByUnicodeName;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
|
:global ToLower;
|
||||||
:global Unix2Dos;
|
:global Unix2Dos;
|
||||||
:global UrlEncode;
|
:global UrlEncode;
|
||||||
:global ValidateSyntax;
|
:global ValidateSyntax;
|
||||||
|
|
@ -302,6 +303,24 @@
|
||||||
:return $Path;
|
:return $Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# convert string to lower case
|
||||||
|
:set ToLower do={
|
||||||
|
:local Input [ :tostr $1 ];
|
||||||
|
:local Upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
:local Lower "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
:local Return "";
|
||||||
|
|
||||||
|
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||||
|
:local Char [ :pick $Input $I ];
|
||||||
|
:local Pos [ :find $Upper $Char ];
|
||||||
|
:if ([ :typeof $Pos ] != "nil") do={
|
||||||
|
:set Char [ :pick $Lower $Pos ($Pos + 1) ];
|
||||||
|
}
|
||||||
|
:set Return ($Return . $Char);
|
||||||
|
}
|
||||||
|
:return $Return;
|
||||||
|
}
|
||||||
|
|
||||||
# clean name for DNS, file and more
|
# clean name for DNS, file and more
|
||||||
:set CleanName do={
|
:set CleanName do={
|
||||||
:local Input [ :tostr $1 ];
|
:local Input [ :tostr $1 ];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue