From 99cbeeb98ad7982811c1843ad84df58ee07a8e8f Mon Sep 17 00:00:00 2001 From: Jean-Remi Desjardins Date: Thu, 6 Jun 2013 13:45:07 -0600 Subject: Document exceptions thrown in some conversion methods of String --- .../scala/collection/immutable/StringLike.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala index 4768413e75..57c43ef90e 100644 --- a/src/library/scala/collection/immutable/StringLike.scala +++ b/src/library/scala/collection/immutable/StringLike.scala @@ -222,12 +222,33 @@ self => */ def r(groupNames: String*): Regex = new Regex(toString, groupNames: _*) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable boolean. + */ def toBoolean: Boolean = parseBoolean(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable byte. + */ def toByte: Byte = java.lang.Byte.parseByte(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable short. + */ def toShort: Short = java.lang.Short.parseShort(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable int. + */ def toInt: Int = java.lang.Integer.parseInt(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable long. + */ def toLong: Long = java.lang.Long.parseLong(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable float. + */ def toFloat: Float = java.lang.Float.parseFloat(toString) + /** + * @throws `java.lang.NumberFormatException` - If the string does not contain a parsable double. + */ def toDouble: Double = java.lang.Double.parseDouble(toString) private def parseBoolean(s: String): Boolean = -- cgit v1.2.3