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#!
极客教程