summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-05-20 19:30:48 +0000
committerPaul Phillips <paulp@improving.org>2009-05-20 19:30:48 +0000
commit4c3d87a50122dba7f8bc2e8b601c10a216d03a38 (patch)
tree940cc7b52e658ebeede037965b7bb41173929f97 /src/library
parentf151228bbd902d48c1d66e99b3779659f4a1b478 (diff)
downloadscala-4c3d87a50122dba7f8bc2e8b601c10a216d03a38.tar.gz
scala-4c3d87a50122dba7f8bc2e8b601c10a216d03a38.tar.bz2
scala-4c3d87a50122dba7f8bc2e8b601c10a216d03a38.zip
Added java.lang.String's other format variant t...
Added java.lang.String's other format variant to RichString. At a glance this may appear to create a conflict because format takes (args: Any*), but since there is no format specifier for a Locale object, the first argument being one such unambiguously means the second variant. i18n or bust!
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/runtime/RichString.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index 954701999d..470cefabfe 100644
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -214,5 +214,22 @@ class RichString(val self: String) extends Proxy with Vector[Char] with VectorTe
*/
def format(args : Any*) : String =
java.lang.String.format(self, args.toArray[Any].asInstanceOf[Array[AnyRef]]: _*)
+
+ /** <p>
+ * Like format(args*) but takes an initial Locale parameter
+ * which influences formatting as in java.lang.String's format.
+ * </p>
+ * <p>
+ * The interpretation of the formatting patterns is described in
+ * <a href="" target="contentFrame" class="java/util/Formatter">
+ * <code>java.util.Formatter</code></a>.
+ * </p>
+ *
+ * @param locale an instance of java.util.Locale
+ * @param args the arguments used to instantiating the pattern.
+ * @throws java.lang.IllegalArgumentException
+ */
+ def format(l: java.util.Locale, args: Any*): String =
+ java.lang.String.format(l, self, args.toArray[Any].asInstanceOf[Array[AnyRef]]: _*)
}