Logo

Programming-Idioms

History of Idiom 110 > diff from v54 to v55

Edit summary for version 55 by programming-idioms.org:
New Java implementation by user [programming-idioms.org]

Version 54

2020-11-26, 12:13:20

Version 55

2020-11-26, 12:14:15

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Code
boolean blank = s==null || s.isBlank();
Comments bubble
Since Java 11
Doc URL
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#isBlank()
Demo URL
https://repl.it/@ProgIdioms/AthleticQuarterlyCommunication