global-functions: add $ParseKeyValueStore
This commit is contained in:
parent
16f04ee7ee
commit
f79ba55637
1 changed files with 16 additions and 0 deletions
|
|
@ -226,3 +226,19 @@
|
||||||
}
|
}
|
||||||
:return true;
|
: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;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue