Skip to content

Tag Archives: Java-Strings

Length and capacity are two different things in Java. Length basically increases when characters are appended to the string whereas the capacity increases when the… Read More
A Java string consists of a group of characters and each character is associated with a Unicode point value (alias ASCII value). So to get… Read More
The Java String hashCode() method is used to return the particular value’s hash value. The hashCode() uses an internal hash function that returns the hash… Read More
In programming, an array is a collection of the homogeneous types of data stored in a consecutive memory location and each data can be accessed… Read More
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. Examples Input - Geeks For Geeks Output - Geeks… 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

Start Your Coding Journey Now!