Scala Char toInt() method with example
Last Updated :
29 Oct, 2019
The toInt() method is utilized to convert a stated character into an integer or its ASCII value of type Int.
Method Definition: def toInt: Int
Return Type: It returns Integer or ASCII value of the corresponding character of type Int.
Example: 1#
object GfG
{
def main(args : Array[String])
{
val result = 'A' .toInt
println(result)
}
}
|
Example: 2#
object GfG
{
def main(args : Array[String])
{
val result = '9' .toInt
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...