Is there any common function (in apache commons or similar) to make maps from query-parameter-like strings?
To specific:
Variant a (Querystring)
s="a=1&b=3"
=> Utils.mapFunction(s, '&', '=')
=> (Hash)Map { a:1; b:3 }
Variant b (Cachecontrol-Header)
s="max-age=3600;must-revalidate"
=> Utils.mapFunction(s, ';', '=')
=> (Hash)Map { max-age:3600; must-revalidate:true }
I don't want to reinvent the wheel.
Thanks
stringtomap
Try it out or browse the source code to see how it has been implemented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With