Open In App

Scala Char toLong() method with example

Last Updated : 03 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The toLong() method is utilized to convert a stated character into Long or its ASCII value of type Long.

Method Definition: def toLong: Long

Return Type: It returns Long or ASCII value of the corresponding letter of type Long.

Example: 1#




// Scala program of toLong()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toLong method
        val result = '\u1155'.toLong
          
        // Displays output
        println(result)
      
    }


Output:

4437

Example: 2#




// Scala program of toLong()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toLong method
        val result = '\u1234'.toLong
          
        // Displays output
        println(result)
      
    }


Output:

4660


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads