Empty string: Difference between revisions

Content added Content deleted
Line 53: Line 53:
return s is "";
return s is "";
}</lang>
}</lang>

=={{header|Icon}} and {{header|Unicon}}==
Icon and Unicon don't have special syntax for null strings but can produce them in several ways
<lang Icon>s := "" # null string
s := string('A'--'A') # ... converted from cset difference
s := char(0)[0:0] # ... by slicing

s1 == "" # lexical comparison, could convert s1 to string
s1 === "" # comparison won't force conversion
*s1 = 0 # zero length, however, *x is polymorphic
*string(s1) = 0 # zero length string

s1 ~== "" # non null strings comparisons
s1 ~=== ""
*string(s1) ~= 0

s := &null # NOT a null string, null type
/s # test for null type
\s # test for non-null type </lang>


=={{header|J}}==
=={{header|J}}==