summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-04-08 15:26:23 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-04-08 15:26:23 +0000
commite8f9c640937df828cec892834c1197e922669bd8 (patch)
tree1b1b1d2ecbeaface57f4af7fabf9de256003bcc4
parent46669b8f044c209ace6b097569b661fadc672fe6 (diff)
downloadscala-e8f9c640937df828cec892834c1197e922669bd8.tar.gz
scala-e8f9c640937df828cec892834c1197e922669bd8.tar.bz2
scala-e8f9c640937df828cec892834c1197e922669bd8.zip
Trunk version of console now uses printf.
-rw-r--r--src/library/scala/Console.scala11
-rw-r--r--test/files/jvm/console.scala2
2 files changed, 6 insertions, 7 deletions
diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala
index fe29150caa..d48a849aef 100644
--- a/src/library/scala/Console.scala
+++ b/src/library/scala/Console.scala
@@ -167,8 +167,8 @@ object Console {
* </p>
* <p>
* The interpretation of the formatting patterns is described in
- * <a href="" target="contentFrame" class="java/text/MessageFormat">
- * <code>java.text.MessageFormat</code></a>.
+ * <a href="" target="contentFrame" class="java/util/Formatter">
+ * <code>java.util.Formatter</code></a>.
* </p>
*
* @param text the pattern for formatting the arguments.
@@ -182,10 +182,9 @@ object Console {
* target="contentFrame">Console.printf</a>.
*/
def format(text: String, args: Any*): Unit =
- out.print(
- if (text eq null) "null"
- else MessageFormat.format(text, textParams(args))
- )
+ if (text eq null) "null" else
+ out.printf(text, args.asInstanceOf[scala.runtime.BoxedObjectArray].
+ unbox(args.getClass).asInstanceOf[Array[Object]])
/** Read a full line from the terminal.
*
diff --git a/test/files/jvm/console.scala b/test/files/jvm/console.scala
index 953a60f7bf..b07765675c 100644
--- a/test/files/jvm/console.scala
+++ b/test/files/jvm/console.scala
@@ -9,6 +9,6 @@ object Test extends Application {
flush
println("..")
println(1)
- printf("Argument nr. {0,number} has value {1,number,#.##}\n",
+ printf("Argument nr. %d has value %1.2f\n",
1, 10.0/3)
}