Empty string

Create an empty string:

var s = "";
var s = String.new;

These expressions all evaluate to true to determine emptiness:

s == "";
s.length == 0;
s.is_empty;
s ~~ /^\z/;
s ~~ /\A\z/;

Non-empty expressions, in addition to simply negating the above expressions:

!= "";
s.length > 0;
s ~~ /./s;
!~ /^\z/;

Last updated