Java | Apache Commons StringUtils
The Apache Commons library is utility library provides many features which lacks in existing Java Core Framework. It is widely used open sourced library. In this post, we are going to learn utility methods provided by StringUtils class. Unlike Java's String class, Apache StringUtils class methods are null-safe. This means no NullPointerExeception is thrown if null value is sent. Below are popular methods used - Complete list of methods can be found at Apache commons StringUtils methods StringUtils.isEmpty() / StringUtils.isBlank() This methods used to check if a String contains any text. Both of these return true if the String is empty. The method isBlank() will return true if a String contains only whitespaces. StringUtils.isNotBlank() Checks if a string is not empty (""), not null and not whitespace only. StringUtils.equals() This case sensitive method compares two strings, returning true if they represent equal sequences of characters. Two null references are considere...