Last active
April 7, 2019 05:10
-
-
Save ratulSharker/336ced848d93530fd997054ef49c60f6 to your computer and use it in GitHub Desktop.
Parsing the query string parameter from String.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
func getQueryValue(param: String) -> String? { | |
return URLComponents(string: self)?.queryItems?.filter({ (queryItem) -> Bool in | |
return queryItem.name == param | |
}).first?.value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment