Skip to content

Tag Archives: Java-Strings

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
Line break (“\n”) is a single character, to replace all line breaks from strings replace() function can be used. String replace(): returns a new String… 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
A LinkedList is a linear data structure, in which the elements are not stored at contiguous memory locations. For converting a linked list to a… Read More
Converting String to ArrayList means each character of the string is added as a separator character element in the ArrayList. Example: Input: 0001 Output: 0… Read More
Given a Set of String, the task is to convert the Set to a comma-separated String in Java. Examples: Input: Set<String> = ["Geeks", "ForGeeks", "GeeksForGeeks"]… Read More
The new operator instantiates a class by dynamically allocating(i.e, allocation at run time) memory for a new object and returning a reference to that memory.… Read More