Just run it on the terminal and this will add a scheduler to automatic active them when the router startup.
Usage:
Code: Select all
[user@server] > :put [$toupper "www.goonet.com.br"]
WWW.GOONET.COM.BR
[user@server] > :put [$tolower "WwW.GooNeT.CoM.Br"]
www.goonet.com.br
Code:
Code: Select all
{
/system scheduler add name=goonet.strcase on-event="{\r\
\n:global strcase do={\r\
\n\t:local toreplaceL {\"A\"=\"a\";\"B\"=\"b\";\"C\"=\"c\";\"D\"=\"d\";\"E\"=\"e\";\"F\"=\"f\";\"G\"=\"g\";\"H\"=\"h\";\"I\"=\"i\";\"J\"=\"j\";\"K\"=\"k\";\"L\"=\"l\";\
\"M\"=\"m\";\"N\"=\"n\";\"O\"=\"o\";\"P\"=\"p\";\"Q\"=\"q\";\"R\"=\"r\";\"S\"=\"s\";\"T\"=\"t\";\"U\"=\"u\";\"V\"=\"v\";\"X\"=\"x\";\"Z\"=\"z\";\"Y\"=\"y\";\"W\"=\"w\"\
};\r\
\n\t:local toreplaceU {\"a\"=\"A\";\"b\"=\"B\";\"c\"=\"C\";\"d\"=\"D\";\"e\"=\"E\";\"f\"=\"F\";\"g\"=\"G\";\"h\"=\"H\";\"i\"=\"I\";\"j\"=\"J\";\"k\"=\"K\";\"l\"=\"L\";\
\"m\"=\"M\";\"n\"=\"N\";\"o\"=\"O\";\"p\"=\"P\";\"q\"=\"Q\";\"r\"=\"R\";\"s\"=\"S\";\"t\"=\"T\";\"u\"=\"U\";\"v\"=\"V\";\"x\"=\"X\";\"z\"=\"Z\";\"y\"=\"Y\";\"w\"=\"W\"\
};\r\
\n\t:local toreplace \$toreplaceL;\r\
\n\t:local str \$1;\r\
\n\t:local newStr;\r\
\n\t:local newChar;\r\
\n\r\
\n\t:if (\$2 = \"-u\") do={\r\
\n\t\t:set toreplace \$toreplaceU;\r\
\n\t}\r\
\n\r\
\n\t:for i from=0 to=([:len \$str] - 1) do={\r\
\n\t :local char [:pick \$str \$i];\r\
\n\t :set newChar (\$toreplace->\$char);\r\
\n\t \r\
\n\t :if ([:typeof \$newChar] = \"str\") do={\r\
\n\t\t:set char \$newChar;\r\
\n\t }\r\
\n\t :set newStr (\$newStr . \$char);\r\
\n\t}\r\
\n\t:return \$newStr;\r\
\n}\r\
\n\r\
\n:global tolower do={ :global strcase; return [\$strcase \$1]};\r\
\n:global toupper do={ :global strcase; return [\$strcase \$1 -u]}\r\
\n}" policy=read,write,policy,test start-time=startup
}