Home »
Code Examples »
Scala Code Examples
Scala - Using String interpolation for formatting text Code Example
The code for Using String interpolation for formatting text
println("Using String interpolation for formatting text")
val name: String = "Alvin Alexander"
val age: Int = 38
println(f"$name%20s $age")
/*
Output:
Using String interpolation for formatting text
Alvin Alexander 38
*/
Code by IncludeHelp,
on August 8, 2022 03:17