aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--global-functions16
1 files changed, 16 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index b8afcd4..00eb0c9 100644
--- a/global-functions
+++ b/global-functions
@@ -226,3 +226,19 @@
}
:return true;
}
+
+# parse key value store
+:global ParseKeyValueStore do={
+ :global CharacterReplace;
+
+ :local Source $1;
+ :if ([ :typeof $Source ] != "array") do={
+ :set Source [ :tostr $1 ];
+ }
+ :local Result [ :toarray "" ];
+ :foreach KeyValue in=[ :toarray $Source ] do={
+ :set KeyValue [ :toarray [ $CharacterReplace $KeyValue "=" "," ] ];
+ :set ($Result->($KeyValue->0)) ($KeyValue->1);
+ }
+ :return $Result;
+}