wifinigel.MikrotikScripting/scripts/v6/ch9-06-str-funcs-mod.rsc
2023-03-06 20:56:48 +00:00

24 lines
No EOL
612 B
Text

# filename: ch9-06-str-funcs-mod.rsc
# function to remove spaces from a string
#
# e.g. :local NoSpaceVar [$RemoveSpaceFunc "string with spaces"]
#
:global RemoveSpaceFunc do={
:local NewName ""
for CharNumber from=0 to=([:len $1]-1) do={
:local Tmp [:pick $1 $CharNumber]
:if ($Tmp !=" ") do={ :set NewName "$NewName$Tmp" }
}
:return $NewName
}
# --- end of function ---
# function to remove last char from a string
#
# e.g. :local ChoppedVar [$ChopStrFunc "string with extra char,"]
#
:global ChopStrFunc do={
:return [ :pick $1 0 ( [ :len $1 ] -1 ) ];
}
# --- end of function ---