mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-05 15:44:29 +02:00
global-functions: $CleanName: do not start with a dash
This commit is contained in:
parent
b0f58696f3
commit
755db5d66d
1 changed files with 12 additions and 4 deletions
|
@ -230,12 +230,20 @@
|
||||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||||
:local Char [ :pick $Input $I ];
|
:local Char [ :pick $Input $I ];
|
||||||
:if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-" $Char ] ] = "nil") do={
|
:if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-" $Char ] ] = "nil") do={
|
||||||
|
:do {
|
||||||
|
:if ([ :len $Return ] = 0) do={
|
||||||
|
:error true;
|
||||||
|
}
|
||||||
|
:if ([ :pick $Return ([ :len $Return ] - 1) ] = "-") do={
|
||||||
|
:error true;
|
||||||
|
}
|
||||||
:set Char "-";
|
:set Char "-";
|
||||||
|
} on-error={
|
||||||
|
:set Char "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
:if ($Char != "-" || [ :pick $Return ([ :len $Return ] - 1) ] != "-") do={
|
|
||||||
:set Return ($Return . $Char);
|
:set Return ($Return . $Char);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
:return $Return;
|
:return $Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue