Loading

Programs over different functions provided by String Class:                                                    

package quipoin.javaeasyprograms;
public class BasicStringFunctions {

	public static void main(String[] args) {
    String s="Hello this is QuipoIn";
    
    // Gives the length of String
    System.out.println(s.length()); 
    
    // Convert given String to UPPERCASE
    System.out.println(s.toUpperCase());
    
    // Convert given String to LOWERCASE
    System.out.println(s.toLowerCase());
    
    // Remove spaces between the words
    System.out.println(s.stripTrailing());
    
    // Replace spaces with underscore
    System.out.println(s.replace(" ","_"));
    
    // Join or concatenate two Strings
    System.out.println(s.concat(".com"));
    
    // Check whether given char sequence is present or not
    System.out.println(s.contains("this"));
    
    // Check whether the given String is empty or not
    System.out.println(s.isEmpty());
    
    // Create a substring of given String
    System.out.println(s.substring(6));
	}
}

Output:

21
HELLO THIS IS QUIPOIN
hello this is quipoin
Hello this is QuipoIn
Hello_this_is_QuipoIn
Hello this is QuipoIn.com
true
false
this is QuipoIn