java.lang does not contain a class called StringUtils. Several third-party libs do, such as Apache Commons Lang or the Spring framework. Make sure you have the relevant jar in your project classpath and import the correct class.

Answer from Jonik on Stack Overflow
🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.20.0 API)
StringUtils.defaultString(null, "NULL") = "NULL" StringUtils.defaultString("", "NULL") = "" StringUtils.defaultString("bat", "NULL") = "bat" Since this is now provided by Java, instead call Objects.toString(Object, String):
🌐
Oracle
docs.oracle.com › cd › E55783_02 › Platform.11-2 › apidoc › atg › core › util › StringUtils.html
StringUtils (ATG Java API)
java.lang.Object · atg.core.util.StringUtils · public class StringUtils extends java.lang.Object · This class contains static methods for performing various operations on Strings.
🌐
Spring
docs.spring.io › spring-framework › docs › current › javadoc-api › org › springframework › util › StringUtils.html
StringUtils (Spring Framework 7.0.5 API)
This class delivers some simple functionality that should really be provided by the core Java String and StringBuilder classes. It also provides easy-to-use methods to convert between delimited strings, such as CSV strings, and collections and arrays. Since: 16 April 2001 · Author: Rod Johnson, ...
🌐
Medium
medium.com › @vino7tech › useful-stringutils-methods-in-java-833dc5236f0a
Useful StringUtils Methods in Java | by Vinotech | Medium
September 29, 2024 - Useful StringUtils Methods in Java StringUtils is a utility class commonly used in Java to perform operations on String objects. It contains a collection of static methods that simplify various …
🌐
Educative
educative.io › answers › what-is-stringutilsleft-in-java
What is StringUtils.left() in Java?
the methods in Java that can be called without creating an object of the class method of the StringUtils class which is used to get the specified number of leftmost characters of a string.
Find elsewhere
🌐
AWS
sdk.amazonaws.com › java › api › latest › software › amazon › awssdk › utils › StringUtils.html
StringUtils (AWS SDK for Java - 2.42.6)
java.lang.Object · software.amazon.awssdk.utils.StringUtils · @SdkProtectedApi public final class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace ·
🌐
Apache Commons
commons.apache.org › proper › commons-lang › jacoco › org.apache.commons.lang3 › StringUtils.java.html
StringUtils.java
* @return the passed in String, or the empty String if it was {@code null}. * @see Objects#toString(Object, String) * @see String#valueOf(Object) */ public static String defaultString(final String str) { return Objects.toString(str, EMPTY); } /** * Returns either the given String, or if the String is {@code null}, {@code nullDefault}. * * <pre> * StringUtils.defaultString(null, "NULL") = "NULL" * StringUtils.defaultString("", "NULL") = "" * StringUtils.defaultString("bat", "NULL") = "bat" * </pre> * <p> * Since this is now provided by Java, instead call {@link Objects#toString(Object, String)}: * </p> * * <pre> * Objects.toString(null, "NULL") = "NULL" * Objects.toString("", "NULL") = "" * Objects.toString("bat", "NULL") = "bat" * </pre> * * @param str the String to check, may be null.
🌐
Maven Repository
mvnrepository.com › artifact › org.apache.commons › commons-lang3
Maven Repository: org.apache.commons » commons-lang3
November 12, 2025 - Apache Commons Lang, a package of Java utility classes for the classes that are in java.lang's hierarchy, or are considered to be so standard as to justify existence in java.lang.
🌐
GeeksforGeeks
geeksforgeeks.org › java › string-handling-with-apache-commons-stringutils-class-in-java
String Handling with Apache Commons' StringUtils Class in Java - GeeksforGeeks
April 28, 2025 - StringUtils is a utility class that provides a wide range of String manipulation methods that are not available in the standard Java String class.
🌐
Apache Commons
commons.apache.org › proper › commons-exec › apidocs › org › apache › commons › exec › util › StringUtils.html
StringUtils (Apache Commons Exec 1.6.0 API)
java.lang.Object · org.apache.commons.exec.util.StringUtils · public class StringUtils extends Object · Supplement of commons-lang, the stringSubstitution() was in a simpler implementation available in an older commons-lang implementation. This class is not part of the public API and could change without warning.
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Apache Commons Lang StringUtils - Java Code Geeks
October 21, 2012 - So, thought it’d be good to talk about another Java library that I like. It’s been around for a while and is not perhaps the most exciting library, but it is very very useful. I probably make use of it daily. ... StringUtils is part of Apache Commons Lang (http://commons.apache.org/lang/), and as the name suggest it provides some nice utilities for dealing with Strings, going beyond what is offered in java.lang.String.
🌐
Dataiku
doc.dataiku.com › dss › api › 12 › scoring › com › dataiku › scoring › util › StringUtils.html
StringUtils
java.lang.Object · com.dataiku.scoring.util.StringUtils · public class StringUtils extends java.lang.Object · clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait · public static final java.util.regex.Pattern KEEP_ALPHANUM_DASHES ·
🌐
Usgs
usgs.github.io › pdl › coverage › gov.usgs.util › StringUtils.java.html
StringUtils.java
/* * StringUtils * * $Id$ * $HeadURL$ */ package gov.usgs.util; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.util.Iterator; import java.util.LinkedList; import java.util.List; /** * String parsing and utility functions.
🌐
Amir Boroumand
steelcityamir.com › blog › do-you-still-need-apache-commons-stringutils-with-modern-java
Do You Still Need Apache Commons StringUtils in Modern Java? · Amir Boroumand | Software engineer based in Pittsburgh, PA
May 22, 2024 - From null-safe string checks to string joins and abbreviations, StringUtils provided convenient static methods that simplified Java string manipulation.
🌐
AWS
docs.aws.amazon.com › AWSJavaSDK › latest › javadoc › com › amazonaws › util › StringUtils.html
StringUtils (AWS SDK for Java - 1.12.797)
java.lang.Object · com.amazonaws.util.StringUtils · public class StringUtils extends Object · Utilities for converting objects to strings. equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait · public static final String COMMA_SEPARATOR ·
🌐
Educative
educative.io › answers › what-is-stringutilsdefaultstring-in-java
What is StringUtils.defaultString in java?
The defaultString is a static method of the StringUtils class that works as follows:
🌐
Educative
educative.io › answers › what-is-stringutilsright-in-java
What is StringUtils.right() in Java?
the methods in Java that can be called without creating an object of the class. method of the StringUtils class that is used to get the rightmost characters of a string.
🌐
Reddit
reddit.com › r/javahelp › string utils
r/javahelp on Reddit: String utils
December 9, 2021 -

Hello everyone, Can someone please help me on this, For example, You have some list of strings and your checking if all the required fields are blank or not using Header= {id, name, grade, address, info}

If(StringUtils.isnotblank(Header) ){ //some logic }

But what if I just want to ignore one field I.e grade, Even if grade is blank it goes inside the condition. But other fields shouldn’t be blank And also if grade is present, it will still work.

Thanks

Top answer
1 of 3
2
You need to separately check only the Header strings that you need to check. These Header variables are probably Strings, and the difficulty with that is you can't compare class objects with "==". You can do this with primitives like int and double, but not with objects. But String has an "isEmpty" function so you can use that if the string is not null.
2 of 3
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
Qvera
qvera.com › kb › index.php › 2000 › how-to-use-stringutils-containsany
How to use StringUtils.ContainsAny? - Knowledge Base - Qvera
July 31, 2018 - I see a documented function for StringUtils.ContainsAny but not much information beyond the signature. ... Does it match by RegEx or something else?