Using varargs from Scala
def foo(msf: String, o: AnyRef, os: AnyRef*) =
println( String.format(msf, (o :: os.toList).toArray : _* ))
def foo(msf: String, o: AnyRef, os: AnyRef*) =
println( String.format(msf, o :: os.toList : _* ) )
or
def foo(msf: String, o: AnyRef, os: AnyRef*) =
println( msf format (o :: os.toList : _* ) )
I much prefer the latter, though it has no locale* support.
- Scala 2.8 does have locale support with RichString's format.