Convert Java String to Uppercase

This example shows how to call a built-in Java® String class method, toUpperCase.

Create a Java string using the built-in class java.lang.String.

str = java.lang.String('hello');

Display methods for the string.

methods(str)
Methods for class java.lang.String:

String               getBytes             replaceAll           
charAt               getChars             replaceFirst         
codePointAt          getClass             split                
codePointBefore      hashCode             startsWith           
codePointCount       indexOf              subSequence          
compareTo            intern               substring            
compareToIgnoreCase  isEmpty              toCharArray          
concat               lastIndexOf          toLowerCase          
contains             length               toString             
contentEquals        matches              toUpperCase          
copyValueOf          notify               trim                 
endsWith             notifyAll            valueOf              
equals               offsetByCodePoints   wait                 
equalsIgnoreCase     regionMatches        
format               replace 

Call the toUpperCase method.

toUpperCase(str)
ans =
 
HELLO
Was this topic helpful?