Skip to content

Tag Archives: Java-Strings

contentEquals() method of String class is used to compare the strings. There are two types of contentEquals method available in java.lang.String with different parameters: contentEquals(StringBuffer… Read More
There are four variants of indexOf() method. indexOf(): This method returns the index within this string of the first occurrence of the specified character or… Read More
String is a sequence of characters, which is widely used in Java Programming. In the Java programming language, strings are objects. In Java, the virtual… Read More
The String class in Java is an immutable and non-primitive data type that is used to store the characters of the sequence. The string is… Read More
lines() method is a static method which returns out stream of lines extracted from a given multi-line string, separated by line terminators which are as… Read More
When we read an XML file and try writing to another XML file it is important for us to take care of special characters in… Read More
JDK 12 introduced indent() method in Java.lang.String class. This method is useful to add or remove white spaces from the beginning of the line to… Read More
String Class stripLeading() method is used to strip leading whitespaces from the string i.e stripLeading() method removes all the whitespaces only at the starting of… Read More
Pattern searching is a crucial problem in computer science. When we do search for a string in notepad/word file or browser or database, pattern searching… Read More
Given a string, write a Java program to replace all line breaks from the given String. ExamplesAttention reader! Don’t stop learning now. Get hold of… Read More
Prior to Java 8 when we need to concatenate a group of strings we need to write that code manually in addition to this we… Read More
Java String Class strip() method returns a string that provides a string with all leading and trailing white spaces removed. This method is similar to… Read More
This method is used to strip trailing whitespaces from the string i.e stripTrailing() method removes all the whitespaces only at the ending of the string. … Read More
The string can be repeated N number of times, and we can generate a new string that has repetitions. repeat() method is used to return… Read More
In Java, strings are objects that are backed internally by a char array. So to convert a string to a byte array, we need a… Read More

Start Your Coding Journey Now!