Open In App

Scala Char getNumericValue() method with example

Improve
Improve
Like Article
Like
Save
Share
Report

The getNumericValue() method is utilized to return the numeric value of the given character.

Method Definition: def getNumericValue: Int

Return Type: It returns Integer.

Example: 1#




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


Output:

35

Example: 2#




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


Output:

11


Last Updated : 03 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads