A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.playframework.com/documentation/2.5.x/api/scala/play/api/data/format/package.html below:

format - play.api.data.format

Contains the Format API used by Form.

For example, to define a custom formatter:

val signedIntFormat = new Formatter[Int] {

  def bind(key: String, data: Map[String, String]) = {
    stringFormat.bind(key, data).right.flatMap { value =>
      scala.util.control.Exception.allCatch[Int]
        .either(java.lang.Integer.parseInt(value))
        .left.map(e => Seq(FormError(key, "error.signedNumber", Nil)))
    }
  }

  def unbind(key: String, value: Long) = Map(
    key -> ((if (value<0) "-" else "+") + value)
  )
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4