Skip to content

Instantly share code, notes, and snippets.

@koogawa
Created July 28, 2015 01:26
Show Gist options
  • Save koogawa/9ce42346be5a8a656da8 to your computer and use it in GitHub Desktop.
Save koogawa/9ce42346be5a8a656da8 to your computer and use it in GitHub Desktop.
ソースコードのキャプチャ付きツイートテスト #CodePiece
private func buildQueryString(fromDictionary parameters: [String: String]) -> String {
var urlVars = [String]()
for (key, var val) in parameters {
val = val.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())!
urlVars += [key + "=" + "\(val)"]
}
return (!urlVars.isEmpty ? "?" : "") + join("&", urlVars)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment