Empty string: Difference between revisions

Content added Content deleted
m (→‎{{header|Ruby}}: Show that s.clear mutates the string.)
m (→‎{{header|UNIX Shell}}: s='2 -gt 3' is not an empty string.)
Line 675: Line 675:


# the "test" command can determine truth by examining the string itself
# the "test" command can determine truth by examining the string itself
if [ $s ]; then echo "not empty"; else echo "empty"; fi
if [ "$s" ]; then echo "not empty"; else echo "empty"; fi


# compare the string to the empty string
# compare the string to the empty string