I have the following URL query:
encodedMessage=PD94bWwgdmVyNlPg%3D%3D&signature=kcig33sdAOAr%2FYYGf5r4HGN
How can I split the query to get the of encodedMessage
and signature
values?
I have the following URL query:
encodedMessage=PD94bWwgdmVyNlPg%3D%3D&signature=kcig33sdAOAr%2FYYGf5r4HGN
How can I split the query to get the of encodedMessage
and signature
values?
The right way to achieve this is to work with URLComponents:
By getting the url components host string and queryItems array, as follows:
queryItems
array contains URLQueryItem objects, which havename
andvalue
properties:Also:
In case of you are getting the query without the full url, I'd suggest to do a pretty simple trick, by adding a dummy host as a prefix to your query string, as follows:
You can get the key value pairs this way:
I am not sure if that's what you were looking for or not. If it is not, could you please clarify a bit further as to what you are looking for?