Empty string: Difference between revisions

Content added Content deleted
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(Add Avail entry)
Line 302: Line 302:
If (var != "")
If (var != "")
Msgbox the var is not empty</lang>
Msgbox the var is not empty</lang>

=={{header|Avail}}==
The type string is defined as <code><character…|></code> (a tuple of characters), so the empty tuple and the empty string are equivalent values, and all tuple/collection methods can be used on strings.

<lang Avail>emptyStringVar : string := "";
Assert: emptyStringVar = "";
Assert: emptyStringVar = <>;
Assert: emptyStringVar is empty;
Assert: |emptyStringVar| = 0;</lang>

Checking that a string is _not_ empty generally isn't any more interesting, just a logical negation of the above tests.

<lang Avail>nonemptyStringVar : string := "content!";
Assert: nonemptyStringVar ≠ "";
Assert: nonemptyStringVar ≠ <>;
Assert: ¬nonemptyStringVar is empty;
Assert: |nonemptyStringVar| > 0;</avail>

The library also defines a type _nonempty string_, which can be leveraged for a type-membership check.

<lang Avail>Assert: nonemptyStringVar ∈ nonempty string;</lang>


=={{header|AWK}}==
=={{header|AWK}}==