Empty string: Difference between revisions

Content added Content deleted
(Ruby: Let the regular expressions work when string contains newlines "\n".)
Line 738:
s.empty?
s.length == 0
s[/^$\A\z/]
 
# also silly things like
Line 746:
<lang ruby>s != ""
s.length > 0
s[/./m]</lang>
 
Note that we can '''not''' do the following, because the empty string is equivalent to true in Ruby ([[Boolean values#Ruby]]):
<lang ruby>if s then puts "not empty" end # This code is wrong!</lang>
 
=={{header|Run BASIC}}==
<lang runbasic>var$ = ""