Skip to content

Instantly share code, notes, and snippets.

@MrAIring
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save MrAIring/3d40923f9e987d6b19bf to your computer and use it in GitHub Desktop.

Select an option

Save MrAIring/3d40923f9e987d6b19bf to your computer and use it in GitHub Desktop.

Revisions

  1. MrAIring revised this gist Sep 11, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion OptionSolution1.scala
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    val name: Option[String] =
    request.getParameter("name")
    val upperNameOpt =
    name.map(_trim.toUpperCase).filter(_ != "")
    name.map(_.trim.toUpperCase).filter(_ != "")
    println(upperNameOpt getOrElse "no name value")
  2. MrAIring renamed this gist Sep 11, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. MrAIring created this gist Sep 11, 2014.
    5 changes: 5 additions & 0 deletions OptionSolution1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    val name: Option[String] =
    request.getParameter("name")
    val upperNameOpt =
    name.map(_trim.toUpperCase).filter(_ != "")
    println(upperNameOpt getOrElse "no name value")