Created
March 22, 2013 09:38
-
-
Save EmmanuelDemey/5220070 to your computer and use it in GitHub Desktop.
How to Create a new StringInterpolator in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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