Scala String toUpperCase() method with example
The toUpperCase() method is utilized to convert all the characters of the stated string to uppercase.
Method Definition: String toUpperCase()
Return Type: It returns the resultant string after converting its all the character to uppercase.
Example: 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) } } |
Output:
GEEKSFORGEEKS
Example: 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) } } |
Output:
NID#!