Regular Expressions or Regex is an API for defining String patterns that can be used for searching, manipulating, and editing a text. It is widely… Read More
Tag Archives: Java-String-Programs
Lambda expressions basically express instances of functional interfaces (An interface with a single abstract method is called functional interface. An example is java.lang.Runnable). lambda expressions… Read More
Given a string, now as of we all know that the task is to check whether a string contains only alphabets. Now we will be… Read More
Given two strings s1 and s2, write a snippet to check whether s2 is a rotation of s1. Strings may contain duplicates. Examples: Input :… Read More
Given a string str, consisting of non-alphabetical characters. The task is to remove all those non-alphabetical characters of str and print the words on a… Read More
Before proceeding further with the fuss of immutability, let’s just take a look into the String class and its functionality a little before coming to… Read More
Given a string, the task is to find all the palindromic sub-strings from the given string.In Set – 1, another approach has been already discussed… Read More
Given a string, your task is to remove the whitespaces in the string using Java Regex (Regular Expressions). Examples Input : Hello Everyone . Output… Read More
In Java, we can append a string in an existing file using FileWriter which has an option to open a file in append mode. Java… Read More
Consider the following codes in java: Java // This program prints false class GFG { public static void main(String[] args) { StringBuffer sb1 =… Read More
Write a Java program to take an input string and exchange the first and last word and reverse the middle word. Examples: Input : Hello… Read More
Suppose we have given a string in which some ranges as specified and we have to place the numbers which is between the given range… Read More
Given a string str with uppercase, lowercase and special characters. The input string is to end with either a space or a dot. The problem… Read More
Mobile Number validation criteria: The first digit should contain numbers between 6 to 9. The rest 9 digit can contain any number between 0 to… Read More
String Interning is a method of storing only one copy of each distinct String Value, which must be immutable. By applying String.intern() on a couple… Read More