📜  带有示例的 Scala Char unary_+() 方法

📅  最后修改于: 2022-05-13 01:55:06.285000             🧑  作者: Mango

带有示例的 Scala Char unary_+() 方法

unary_+()方法用于将指定的字符转换为它的值,无需任何修改。

示例:1#

// Scala program of unary_+()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying unary_+ method
        val result = '9'.unary_+
          
        // Displays output
        println(result)
      
    }
} 
输出:
57

示例:2#

// Scala program of unary_+()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying unary_+ method
        val result = 'A'.unary_+
          
        // Displays output
        println(result)
      
    }
} 
输出:
65