![]() |
PING
0.9
Statistical data handling and processing in production environment
|
Retrieve and discard the (key,value) pairs present in a given string/list.
str : strings of items that may be defined as (key,value) pairs of the form A&opB where op is defined below;key : (option) string(s) defining the keys to look for in the input string; a key is defined as the left-hand side of the (key,value) pair A&opB, i.e. A; when passed, only those (key,value) pairs associated to keys in key are retrieved; when not passed (i.e. left blank), the macro retrieves all possible keys present in the input string;value : (option) string(s) defining the values to look for in the input string; a value is defined as the right-hand side of the (key,value) pair A&opB, i.e. B; when passed, the values retrieved from the input string are matched against those in value; by default, value is not considered;op : (option) separator character of (key,value) pairs in input string str; default: op=quote(=);sep : (option) character/string separator in input list; default: %quote( ), i.e. sep is blank._key_ : (option) name of the variable storing the (list of) key(s) found in (key,value) pairs present of str and that match the criteria on key and value parameters above;_value_ : (option) ibid with value(s);_item_ : (option) name of the variable storing the (key,value) zipped pairs that match the criteria on key and value parameters above;_str_ : (option) updated string from which all (key,value) pairs that macth the criteria on key and value parameters are discarded.Let us consider the following simple examples:
which sets: ovalue=C, item=K=C and ostr=A,B,D. Let us also consider the following case:
sets: ovalue=C G, okey=K1 K4, item=K1=C,K4=G and ostr=A,B,D,K2=E,K3=,F, while
sets: ovalue=C E _EMPTY_ G, okey=K1 K2 K3 K4, item=K1=C,K2=E,K3=,K4=G and ostr=A,B,D,F.
Run macro %_example_str_to_keyvalue for more examples.
(key,value) pairs in the input string parameter str are unique!(key,value) pairs returned through _item_ are built using %list_append.