Skip to content

Instantly share code, notes, and snippets.

@EmmanuelDemey
Created March 22, 2013 09:38
Show Gist options
  • Save EmmanuelDemey/5220070 to your computer and use it in GitHub Desktop.
Save EmmanuelDemey/5220070 to your computer and use it in GitHub Desktop.
How to Create a new StringInterpolator in Scala
implicit class formatHours(val sc: StringContext) {
def fh(args: Any*): String = sc.s(args.map(m => "%02d".format(m)): _*)
}
override lazy val toString = fh"$hours:$minutes"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment