Home > Java > JavaBase > What are the methods to determine whether a string is empty in java

What are the methods to determine whether a string is empty in java

王林
Release: 2019-11-21 15:58:49
Original
3156 people have browsed it

What are the methods to determine whether a string is empty in java

Method one:

   if(StringUtils.isNotBlank(str))//判断字符串不为空
   或if(StringUtils.isBlank(str))//判断字符串为空
Copy after login

Method two:

   if(s == null ||"".equals(s));
Copy after login

Method three: Compare string length

   if(s == null || s.length() <= 0);
Copy after login

Method Four:

   if(s == null || s.isEmpty());
Copy after login

Method five:

   if (s == null || s == "");
Copy after login

Recommended tutorial: java quick start

The above is the detailed content of What are the methods to determine whether a string is empty in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template