String Class and Functions
Java Program

import java.io.*;
import java.util.*;

class Test
{
    public static void main(String[] args)
    {
        String s = "HelloWorld";
        // or String s = new String("HelloWorld");

        // Returns the number of characters in the String.
        System.out.println("String length = " + s.length());

        // Returns the character at ith index.
        System.out.println("Character at 3rd position = " + s.charAt(3));

        // Return the substring from the ith index character to end of string
        System.out.println("Substring " + s.substring(3));

        // Returns the substring from i to j-1 index.
        System.out.println("Substring = " + s.substring(2, 5));

        // Concatenates string2 to the end of string1.
        String s1 = "Hello";
        String s2 = "Java";
        System.out.println("Concatenated string = " + s1.concat(s2));

        // Returns the index within the string of the first occurrence of the specified string.
        String s4 = "Learn Share Learn";
        System.out.println("Index of Share " + s4.indexOf("Share"));

        // Returns the index within the string starting at the specified index.
        System.out.println("Index of a = " + s4.indexOf('a', 3));

        // Converting cases
        String w1 = "GeEkYmE";
        System.out.println("Changing to lower Case " + w1.toLowerCase());

        // Converting cases
        String w2 = "GeEkYmE";
        System.out.println("Changing to UPPER Case " + w2.toUpperCase());

        // Trimming the word
        String w4 = "Learn Share Learn ";
        System.out.println("Trim the word " + w4.trim());

        // Replacing characters
        String str1 = "fello";
        System.out.println("Original String " + str1);
        String str2 = str1.replace('f', 'h');
        System.out.println("Replaced f with h -> " + str2);
    }
}