mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-07-15 04:24:30 +02:00
initial commit
This commit is contained in:
commit
c782dde326
61 changed files with 1457 additions and 0 deletions
30
scripts/ch9-07-use-str-module.rsc
Normal file
30
scripts/ch9-07-use-str-module.rsc
Normal file
|
@ -0,0 +1,30 @@
|
|||
# filename: ch9-07-use-str-module.rsc
|
||||
|
||||
# import the functions we need and declare the function names we wish to use
|
||||
/import "ch9-06-str-funcs-mod.rsc"
|
||||
:global RemoveSpaceFunc;
|
||||
:global ChopStrFunc;
|
||||
|
||||
# check our function names are valid
|
||||
if ([:typeof $RemoveSpaceFunc] != "array") do={
|
||||
:error "RemoveSpaceFunc is wrong data type or does not exist.";
|
||||
}
|
||||
|
||||
if ([:typeof $ChopStrFunc] != "array") do={
|
||||
:error "ChopStrFunc is wrong data type or does not exist.";
|
||||
}
|
||||
|
||||
# create a string to use with the functions
|
||||
:local StringToModify "txBroadcast = 201,";
|
||||
|
||||
# print original string
|
||||
:put ("Orignal string: $StringToModify");
|
||||
|
||||
# use both functions to modify the string
|
||||
:local ModifiedString [$RemoveSpaceFunc $StringToModify];
|
||||
:set ModifiedString [$ChopStrFunc $ModifiedString];
|
||||
:put ("Modified string: $ModifiedString");
|
||||
|
||||
# tidy up the global namespace (optional)
|
||||
:set RemoveSpaceFunc;
|
||||
:set ChopStrFunc;
|
Loading…
Add table
Add a link
Reference in a new issue