Scala 字符串toUpperCase()方法及示例

Scala 字符串toUpperCase()方法及示例

toUpperCase()方法用于将所述字符串的所有字符转换为大写字母。

方法定义。String toUpperCase()

返回类型。返回所有字符转换为大写字母后的结果字符串。

例子: 1#

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

输出。

GEEKSFORGEEKS

例如:2#

// Scala program of toUpperCase()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toUpperCase method
        val result = "nid#!".toUpperCase()
          
        // Displays output
        println(result)
      
    }
} 

输出。

NID#!

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程