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




capitalize( ) FUNCTION


capitalize( ) Function


The capitalize( ) Function is used to convert the first letter of the String to uppercase.


Example :


x = "hello beautiful world"
y = x.capitalize()
print(y)


Output :



  Hello beautiful world

In the above code, we have declared a String 'hello beautiful world'.


x = "hello beautiful world"

java_Collections

Then we have used the 'capitalize( )' function to convert the first letter of the String to uppercase.


y = x.capitalize( )

And assign to variable 'y'.


java_Collections

And, we print the value of 'y'.


print(y)

And we got the below output.


Hello beautiful world