- StringUtils.isNotBlank("vaiable") function return false for null,Empty and whitespace string.
- Where as StringUtils.isNotEmpty("variable") function return true for whiteSpace string.
- This function is null safe.
- You can use this method with the help of commons-lang-2.6.jar.
- You can download this jar by using the below link.
- package com.utilitySample;
- import org.apache.commons.lang.StringUtils;
- public class StringUtility {
- public static void main(String[] args) {
- System.out.println(StringUtils.isNotBlank(null));
- System.out.println(StringUtils.isNotBlank(""));
- System.out.println(StringUtils.isNotBlank(" "));
- System.out.println(StringUtils.isNotBlank("vel"));
- System.out.println(StringUtils.isNotBlank(" vel "));
- }
- }
Output :
false
false
false
true
true
No comments:
Post a Comment