Jump to content

Empty string: Difference between revisions

Line 53:
return s is "";
}</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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.