Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a method which convert elements in String to BigInt?

Tags:

scala

This code :

1234.toString.map(_.asDigit) 

returns :

scala.collection.immutable.IndexedSeq[Int] = Vector(1, 2, 3, 4)

but I need a scala.collection.immutable.IndexedSeq[BigInt]

There does not seem to be a method such as asBigInt which will convert the String characters to BigInt . How can this be done ?

like image 708
blue-sky Avatar asked Aug 31 '25 05:08

blue-sky


1 Answers

1234.toString.map(_.asDigit).map(BigInt(_))
like image 186
Carsten Avatar answered Sep 05 '25 00:09

Carsten