Learn to format string to phone number pattern which is (123) 456-6789. This conversion is generally required in applications where customer’s data has to be displayed and phone number is part of this data. How to format string to phone number with dashes To format string to phone number – Break the string to 3 […]
Learn how to get first 4 characters of a String or simply any number of first characters of a string in Java. Get first 4 characters of String – Example To get substring having first 4 chars first check the length of string. If string length is greater than 4 then substring(int beginIndex, int lastIndex) […]
Learn how to get last 4 characters of a String or simply any number of last characters of a string in Java.
The Java String intern() return the reference of a equal string literal present in string pool. String literals are automaically interned in Java.
The Java String contains() searches a substring in the given string. It returns true if substring are found in this string otherwise returns false. 1. String contains() method Use String.contains() to find is a substring is present in given string or not. Please remember that this method is case sensitive. 1.1. Method syntax The method […]