FromDigits

scala.util.FromDigits
See theFromDigits companion object
trait FromDigits[T]

A type class for types that admit numeric literals.

Type parameters

T

the numeric type that digit strings can be converted to

Attributes

Companion
object
Source
FromDigits.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Decimal[T]
trait Floating[T]
trait WithRadix[T]

Members list

Value members

Abstract methods

def fromDigits(digits: String): T

Converts digits string to value of type T digits can contain

Converts digits string to value of type T digits can contain

  • sign + or -
  • sequence of digits between 0 and 9

Value parameters

digits

the string representation of the numeric literal to convert

Attributes

Returns

the value of type T represented by the digit string

Throws
FromDigits.MalformedNumber

if digit string is not legal for the given type

FromDigits.NumberTooLarge

if value of result does not fit into T's range

FromDigits.NumberTooSmall

in case of numeric underflow (e.g. a non-zero floating point literal that produces a zero value)

Source
FromDigits.scala