split-string <string> with <delimiter> to <result> [ count <count> ] split-string delete <result>Copied!
%% /parse public set-string clist = "a , b, \"c , d\" , e" split-string clist with "," to res count tot start-loop repeat tot use i read-split i from res to item status st if-true st not-equal GG_OKAY break-loop end-if // Output each item print-format " [%s]", item end-loop %%Copied!
sudo mgrg -i -u $(whoami) ps gg -q gg -r --req="/parse" --exec --silent-headerCopied!
[a] [b] [c , d] [e]Copied!
%% /parse-url public // Data to parse - data/value pairs delimited by "&" string, and data and value delimited by equal sign: set-string url ="x=23&y=good&z=hello_world" // Split string first into pieces based on "amp;" split-string url with "&" to url_var count tot // For each of name=value pairs, split it with equal sign start-loop repeat tot use i // Get a url pair (each separated with "&") read-split i from url_var to item // Then split that with "=" split-string item with "=" to item_var // Get name and value read-split 1 from item_var to name read-split 2 from item_var to val print-format "Variable %s has value %s\n", name, val end-loop %%Copied!
Variable x has value 23 Variable y has value good Variable z has value hello_worldCopied!