Empty string: Difference between revisions

Content added Content deleted
(→‎{{header|C sharp}}: Added additional explanation)
Line 28:
 
The check for a non-empty string is the same, but with "not" after the n:=
 
=={{header|ACL2}}==
To check if a string is empty:
Line 272 ⟶ 273:
30 IF A$<>"" THEN PRINT "THE STRING IS NOT EMPTY"
40 END</lang>
 
==={{header|Applesoft BASIC}}===
The terminating quote may be left off. By default, strings are initially empty so the assignment is not necessary. Another way to check for an empty string is to use the LEN function.
Line 620 ⟶ 622:
Is not 's' empty?:> $FALSE
</pre>
 
=={{header|D}}==
D treats null strings and empty strings as equal on the value level, but different on object level. You need to take this into account when checking for emptiness.
Line 663 ⟶ 666:
}
}</lang>
 
=={{header|Déjà Vu}}==
Like in Python, empty strings are falsy, non-empty strings are truthy.
Line 914 ⟶ 918:
String is not empty
</pre>
 
=={{header|Free Pascal}}==
Assigning an empty string:
<lang pascal>s := '';</lang>
Checking for an empty string:
<lang pascal>s = ''
length(s) = 0</lang>
Checking for a non-empty string:
<lang pascal>s <> ''
length(s) > 0
longBool(length(s))</lang>
The <code>sysUtils</code> unit defines the constants <code>emptyStr</code> and <code>emptyWideStr</code>, which can be used in place of <code>&#39;&#39;</code>.
 
=={{header|FutureBasic}}==
Line 1,764 ⟶ 1,780:
 
=={{header|Pascal}}==
''See [[Empty_string#Delphi|Delphi]] or [[#Free Pascal|Free DelphiPascal]]''
 
=={{header|Perl}}==
Line 1,939 ⟶ 1,955:
if (isEmpty(s)) print("string s is empty");
if (isEmpty(s)) print("string s is not empty");</lang>
 
=={{header|Red}}==
<lang Red>Red []
Line 1,953 ⟶ 1,970:
>>
</pre>
 
=={{header|Retro}}==
Create an empty string and assign it to a variable. In these '''keepString''' is used to ensure that the string is permanent.
Line 2,031 ⟶ 2,049:
ok
</lang>
 
=={{header|Ruby}}==
 
Line 2,264 ⟶ 2,283:
out "not empty" endl console
end if</lang>
 
=={{header|VAX Assembly}}==
 
Line 2,276 ⟶ 2,296:
ret
.end empty</lang>
 
=={{header|VBA}}==
<lang vb>