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