Last updated 1 year ago
Was this helpful?
Create an empty string:
These expressions all evaluate to true to determine emptiness:
Non-empty expressions, in addition to simply negating the above expressions:
var s = ""; var s = String.new;
s == ""; s.length == 0; s.is_empty; s ~~ /^\z/; s ~~ /\A\z/;
s != ""; s.length > 0; s ~~ /./s; s !~ /^\z/;