All string functions example code in java

The below code demonstrate how to use the all the string functions in java

public class AllStringFuctionExample {
 public static void main(String[] args) {
 String str = "All String function Example in java";

 // convert string into Lower case
 String Lowercase = str.toLowerCase();
 System.out.println("Lower case String ==> " + Lowercase);

 // convert string into upper case
 String Uppercase = str.toUpperCase();
 System.out.println("Upper case String ==> " + Uppercase);

 // Find length of the given string
 System.out.println("Length of the given string ==>" + str.length());

 // Trim the given string i.e. remove all first and last the spaces from
 // the string
 String tempstr = " String trimming example ";
 System.out.println("String before trimming ==> " + tempstr);
 System.out.println("String after trimming ==> " + tempstr.trim());

 // Find the character at the given index from the given string
 System.out.println("Character at the index 6 is ==> " + str.charAt(6));

 // find the substring between two index range
 System.out.println("String between index 3 to 9 is ==> "
 + str.substring(3, 9));

 // replace the character with another character
 System.out.println("String after replacement ==> "
 + str.replace('a', 'Y'));

 // replace the substring with another substring
 System.out.println("String after replacement ==> "
 + str.replace("java", "loan"));
 }
}

output of the above program

Lower case String ==> all string function example in java
Upper case String ==> ALL STRING FUNCTION EXAMPLE IN JAVA
Length of the given string ==>35
String before trimming ==>     String trimming example
String after trimming ==> String trimming example
Character at the index 6 is ==> r
String between index 3 to 9 is ==>  Strin
String after replacement ==> All String function ExYmple in jYvY
String after replacement ==> All String function Example in loan