Logo

Programming-Idioms

History of Idiom 110 > diff from v99 to v100

Edit summary for version 100 by programming-idioms.org:
[Ruby] Added Demo URL

Version 99

2022-09-03, 10:24:16

Version 100

2022-09-03, 10:24:58

Idiom #110 Check if string is blank

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

Idiom #110 Check if string is blank

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

Code
blank = s.strip.empty?
Code
blank = s.strip.empty?
Doc URL
https://ruby-doc.org/core-3.1.2/String.html#method-i-strip
Doc URL
https://ruby-doc.org/core-3.1.2/String.html#method-i-strip
Demo URL
https://replit.com/@ProgIdioms/LightheartedEntireInitialization#main.rb