Skip to content

Instantly share code, notes, and snippets.

@yagince
Created March 24, 2013 13:32
Show Gist options
  • Select an option

  • Save yagince/5231992 to your computer and use it in GitHub Desktop.

Select an option

Save yagince/5231992 to your computer and use it in GitHub Desktop.
StringContext
package interpolation
object StringInterpolation_04 extends App {
println(s"100 + 1 = ${100+1}") // 100 + 1 = 101
println(StringContext("100 + 1 = ", "").s(100+1)) // 100 + 1 = 101
println(StringContext("100 + 1 = ", "%5d").f(100+1)) // 100 + 1 = 101
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment