Skip to content

Instantly share code, notes, and snippets.

View jedichenbin's full-sized avatar

jcb jedichenbin

  • Melbourne, Australia
View GitHub Profile
private def urlDecode(s: String) = URLDecoder.decode(s, "UTF-8")
private def requestParamsSimpleMap(queryString: String): Map[String, String] = {
val kvp : List[(String, String)] = for {
nameVal <- queryString.split("&").toList map (_.trim) filter (_.length > 0)
(name, value) <- nameVal.split("=").toList match {
case n :: v :: _ => Some(urlDecode(n), urlDecode(v))
case n :: Nil => Some(urlDecode(n), "")
case _ => None
}