summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2005-06-24 15:21:57 +0000
committermihaylov <mihaylov@epfl.ch>2005-06-24 15:21:57 +0000
commita93bb8d43f4d40e64822b01e405c00886e9ca272 (patch)
tree7d4f4f1e90a0b08d9bfbf4fcb520b52e6ef2af8c
parentb2dbde80667b753510abf97948be02aac67cba81 (diff)
downloadscala-a93bb8d43f4d40e64822b01e405c00886e9ca272.tar.gz
scala-a93bb8d43f4d40e64822b01e405c00886e9ca272.tar.bz2
scala-a93bb8d43f4d40e64822b01e405c00886e9ca272.zip
Made scala.Console platform independant
-rw-r--r--sources/scala/Console.scala6
-rw-r--r--sources/scala/runtime/compat/Platform.scala2
2 files changed, 6 insertions, 2 deletions
diff --git a/sources/scala/Console.scala b/sources/scala/Console.scala
index 86f62276f1..f9ec8fc490 100644
--- a/sources/scala/Console.scala
+++ b/sources/scala/Console.scala
@@ -164,11 +164,13 @@ object Console {
/** Read a float value from the terminal.
*/
- def readFloat: Float = java.lang.Float.parseFloat(in.readLine());
+ def readFloat: Float =
+ scala.runtime.compat.Platform.parseFloat(in.readLine());
/** Read a double value from the terminal.
*/
- def readDouble: Double = java.lang.Double.parseDouble(in.readLine());
+ def readDouble: Double =
+ scala.runtime.compat.Platform.parseDouble(in.readLine());
/** Read in some structured input, specified by a format specifier.
* See class <code>java.text.MessageFormat</code> for details of
diff --git a/sources/scala/runtime/compat/Platform.scala b/sources/scala/runtime/compat/Platform.scala
index d0fa630f8f..05a6f8e21e 100644
--- a/sources/scala/runtime/compat/Platform.scala
+++ b/sources/scala/runtime/compat/Platform.scala
@@ -19,4 +19,6 @@ object Platform {
def split(str: String, separator: Char): Array[String] = {
str.split(separator.toString());
}
+ def parseFloat(s: String): Float = java.lang.Float.parseFloat(s);
+ def parseDouble(s: String): Double = java.lang.Double.parseDouble(s);
}