aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-04-19 08:59:51 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-04-19 08:59:51 +0200
commit6fd0becf64184184642e719e288bc537a0bee499 (patch)
treee414c18892c63481b2c19fb8b71059b0aaca76c6 /global-functions.rsc
parentb50a5b294a50729e70d96c65ed1a12657bd1adf3 (diff)
global-functions: introduce $ProtocolStrip
Diffstat (limited to 'global-functions.rsc')
-rw-r--r--global-functions.rsc12
1 files changed, 12 insertions, 0 deletions
diff --git a/global-functions.rsc b/global-functions.rsc
index 918ea9a..3b9f27c 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -58,6 +58,7 @@
:global ParseDate;
:global ParseKeyValueStore;
:global PrettyPrint;
+:global ProtocolStrip;
:global RandomDelay;
:global RequiredRouterOS;
:global ScriptFromTerminal;
@@ -885,6 +886,17 @@
:put [ $Unix2Dos $Input ];
}
+# strip protocol from from url string
+:set ProtocolStrip do={
+ :local Input [ :tostr $1 ];
+
+ :local Pos [ :find $Input "://" ];
+ :if ([ :typeof $Pos ] = "nil") do={
+ :return $Input;
+ }
+ :return [ :pick $Input ($Pos + 3) [ :len $Input ] ];
+}
+
# delay a random amount of seconds
:set RandomDelay do={
:local Time [ :tonum $1 ];