Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




toUpperCase() FUNCTION


toUpperCase() Function


The toUpperCase() Function is used to convert all the characters/letters of the String in upper case.


Example :



fun main() {

    var x = "HeLLo"
    var y = x.toUpperCase()
        
    println("The String in upper case is : "+y)
}


Output :



 The String in upper case is : HELLO

In the above code, we have declared a String 'HeLLo', in which the letters 'e' and 'o' are in lower case.


var x = "HeLLo"

java_Collections

So, we have used the 'toUpperCase()' Function to convert them to upper case and assign to a variable 'y'.


var y = x.toUpperCase()

java_Collections