Someone should mention that you should turn up warnings:
apm@mara:~$ skala -Ywarn-infer-any
Welcome to Scala version 2.11.0-20130524-174214-08a368770c (OpenJDK 64-Bit Server VM, Java 1.7.0_21).
Type in expressions to have them evaluated.
Type :help for more information.
scala> "abc".padTo(10, "*").mkString
<console>:7: warning: a type was inferred to be `Any`; this may indicate a programming error.
val res0 =
^
res0: String = abc*******
Note that there's nothing wrong (per se) with doing it this way.
Maybe there's a use case for:
scala> case class Ikon(c: Char) { override def toString = c.toString }
defined class Ikon
scala> List(Ikon('#'),Ikon('@'),Ikon('!')).padTo(10, "*").mkString
res1: String = #@!*******
or better
scala> case class Result(i: Int) { override def toString = f"$i%03d" }
defined class Result
scala> List(Result(23),Result(666)).padTo(10, "---").mkString
res4: String = 023666------------------------
Since this isn't your use case, maybe you should ask if you want to use an API that is verbose and fraught with peril.
That's why Daniel's answer is the correct one. I'm not sure why the format string in his example looks so scary, but it usually looks more benign, since in most readable strings, you only need formatting chars in a few places.
scala> val a,b,c = "xyz"
scala> f"$a is followed by `$b%10s` and $c%.1s remaining"
res6: String = xyz is followed by ` xyz` and x remaining
The one case where you're required to add a spurious formatter is when you want a newline:
scala> f"$a%s%n$b$c"
res8: String =
xyz
xyzxyz
I think the interpolator should handle f"$a%n$b". Oh hold on, it's fixed in 2.11.
scala> f"$a%n$b" // old
<console>:10: error: illegal conversion character
f"$a%n$b"
scala> f"$a%n$b" // new
res9: String =
xyz
xyz
So now there's really no excuse not to interpolate.