The join() method of String class is introduced in Java 8. This method is used to concatenate strings with specified delimiter. It is also used… [Read More]
Java String isEmpty() method
Java String isEmpty() method checks whether a String is empty or not. This method returns true if the given string is empty, else it returns… [Read More]
Java String intern() method
Java String intern() method is used to manage memory by reducing the number of String objects created. It ensures that all same strings share the same memory…. [Read More]
Java String format() method
Java String format() method is used for formatting the String. It works similar to printf function of C, you can format strings using format specifiers…. [Read More]
Java String contains() method
Java String contains() method checks whether a particular sequence of characters is part of a given string or not. This method returns true if a… [Read More]
Difference between String and StringBuffer
In this article, we will discuss the difference between String and StringBuffer. Both of these classes used to handle sequence of characters. However they are… [Read More]
Difference between StringBuilder and StringBuffer
In this article we are gonna discuss the differences between StringBuilder and StringBuffer. Before discussing the differences, lets have a look at what java documentation… [Read More]
How to remove only trailing spaces of a string in Java
In this tutorial we will learn how to trim trailing spaces from the string but not leading spaces. Here is the complete code: class TrimBlanksExample… [Read More]
java – Left padding a String with Spaces and Zeros
In this tutorial we are gonna see how to left pad a string with spaces and zeros: 1) Left pad with spaces class LeftPaddingExample1 {… [Read More]
java – Right padding a String with Spaces and Zeros
In this tutorial we are gonna see how to right pad a string with spaces and zeros: 1) Right pad with spaces public class PadRightExample1… [Read More]
Java – String regionMatches() Method example
The method regionMatches() tests if the two Strings are equal. Using this method we can compare the substring of input String with the substring of… [Read More]
Java – String matches() Method example
Method matches() checks whether the String is matching with the specified regular expression. If the String fits in the specified regular expression then this method… [Read More]
Java – String toCharArray() Method example
The method toCharArray() returns an Array of chars after converting a String into sequence of characters. The returned array length is equal to the length… [Read More]
Java String trim() and hashCode() Methods with examples
In this tutorial we will discuss Java String trim() and hashCode() methods with the help of examples. Java String trim() method signature It returns a… [Read More]
Java – String getBytes() Method example
The getBytes() method encodes a given String into a sequence of bytes and returns an array of bytes. The method can be used in below… [Read More]