diff options
author | Christian Hesse <mail@eworm.de> | 2019-07-17 16:27:21 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-07-17 16:27:21 +0200 |
commit | f79ba55637169f9e05a51f6f8c24e0543c707458 (patch) | |
tree | 5ef1db47f802bf30b7c371d94abcc233626d0465 /global-functions | |
parent | 16f04ee7ee83755b7405835d343f9e056986173b (diff) |
global-functions: add $ParseKeyValueStore
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 16 |
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; +} |