Skip to content

Tag Archives: Java-Strings

String is a special class in Java. substring() is one of the widely used methods of String class. It is used to extract part of… Read More
In this article, we will learn how to move all special char to the end of the String.Examples:   Input : !@$%^&*AJAY Output :AJAY!@$%^&*Input :Geeksf!@orgeek@s A#$ c%o^mputer… Read More
Given a String, the task is to insert another string in between the given String at a particular specified index in Java. Examples: Input: originalString… Read More
Given a size as n, The task is to generate a random alphanumeric String of this size. Below are various ways to generate random alphanumeric… Read More
There are many ways to compare two Strings in Java:   Using == operator Using equals() method Using compareTo() method Using compareToIgnoreCase() method Using compare() method… Read More
Format specifiers begin with a percent character (%) and terminate with a “type character, ” which indicates the type of data (int, float, etc.) that… Read More
Guava’s Joiner class provides various methods to handle joining operations on string, objects, etc. This class provides advanced functionality for the join operation. Declaration: Following… Read More
CaseFormat is a utility class for converting between various ASCII case formats. Behavior is undefined for non-ASCII input. Declaration: The declaration for com.google.common.base.CaseFormat is as:… Read More
The method omitEmptyStrings() returns a splitter that behaves equivalently to this splitter, but automatically omits empty strings from the results. For example, Splitter.on (‘, ‘).omitEmptyStrings().split(“,… Read More
The method trimResults() returns a splitter that behaves equivalently to this splitter, but automatically removes leading and trailing whitespace from each returned substring. For example,… Read More
The method splitToList(CharSequence sequence) splits sequence into string components and returns them as an immutable list. Syntax: public List<String> splitToList(CharSequence sequence) Parameters: This method takes… Read More
The method limit(int limit) returns a splitter that behaves equivalently to this splitter but stops splitting after it reaches the limit. The limit defines the… Read More
Given a String with white spaces, the task is to remove all white spaces from a string using Java built-in methods. Examples: Input: str =… Read More
Given a List of String, the task is to convert the List to a comma separated String in Java. Examples: Input: List<String> = ["Geeks", "ForGeeks",… Read More
 In Java, here we are given a string, the task is to replace a character at a specific index in this string. Examples:  Input: String… Read More

Start Your Coding Journey Now!