Jump to content

Empty string: Difference between revisions

→‎{{header|AWK}}: empty string
No edit summary
(→‎{{header|AWK}}: empty string)
Line 53:
If (var != "")
Msgbox the var is not empty</lang>
 
=={{header|AWK}}==
<lang awk>#!/usr/bin/awk -f
BEGIN {
# Demonstrate how to assign an empty string to a variable.
a="";
b="XYZ";
print "a = ",a;
print "b = ",b;
print "length(a)=",length(a);
print "length(b)=",length(b);
# Demonstrate how to check that a string is empty.
print "Is a empty ?",length(a)==0;
print "Is a not empty ?",length(a)!=0;
# Demonstrate how to check that a string is not empty.
print "Is b empty ?",length(b)==0;
print "Is b not empty ?",length(b)!=0;
}
 
<pre>$ awk -f R/tmp/string.awk
a =
b = XYZ
length(a)= 0
length(b)= 3
Is a empty ? 1
Is a not empty ? 0
Is b empty ? 0
Is b not empty ? 1
</pre>
 
=={{header|Bracmat}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.