All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.udash.utils.URLEncoder.scala Maven / Gradle / Ivy

There is a newer version: 0.13.0
Show newest version
package io.udash.utils

object URLEncoder {
  def encode(query: String, spaceAsPlus: Boolean): String = {
    val res = java.net.URLEncoder.encode(query, "UTF-8")
    if (spaceAsPlus) res else res.replace("+", "%20")
  }

  def decode(query: String, plusAsSpace: Boolean): String = {
    val pre = if (plusAsSpace) query else query.replace("+", "%2B")
    java.net.URLDecoder.decode(pre, "UTF-8")
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy