Skip to content

Instantly share code, notes, and snippets.

@michbarsinai
Created October 27, 2017 13:03
Show Gist options
  • Save michbarsinai/25a205588601bcace2697f7cc03f6413 to your computer and use it in GitHub Desktop.
Save michbarsinai/25a205588601bcace2697f7cc03f6413 to your computer and use it in GitHub Desktop.
Twirl/Play mini function for presenting a HTML fragment for non-null, non-empty strings
def nonEmpty( v:String )(f:(String=>Html)):Html = {
if ( v != null && v.trim.nonEmpty ) {
f(v.trim)
} else {
Html("")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment