Empty string: Difference between revisions

removed langur language example for now
m (→‎{{header|Wren}}: Changed to Wren S/H)
(removed langur language example for now)
 
(3 intermediate revisions by 3 users not shown)
Line 1,281:
 
Also possible is <code>(string= "" str)</code>.
 
An common lisp incompatible way:
<syntaxhighlight lang="langurlisp">val .zls = ""
(defvar str "" "An empty string")
 
(if (length= str 0)
(message "string is empty")
(message "string is not empty"))
writeln len(.zls)</syntaxhighlight>
 
=={{header|EMal}}==
Line 1,882 ⟶ 1,891:
fn.println(parser.op(@$s > 0))
</syntaxhighlight>
 
=={{header|langur}}==
You can use empty quote marks.
<syntaxhighlight lang="langur">val .zls = ""
writeln .zls == ""
writeln .zls != ""
writeln len(.zls)</syntaxhighlight>
 
{{out}}
<pre>true
false
0</pre>
 
=={{header|Lasso}}==
Line 2,176 ⟶ 2,173:
true
false
</pre>true
 
=={{header|langurMiniScript}}==
{{trans|Wren}}
<syntaxhighlight lang="miniscript">string.isEmpty = function
return self == ""
end function
 
number.toBoolStr = function
if self == 0 then return "false"
return "true"
end function
 
s = ""
t = "0"
print "'s' is empty? " + s.isEmpty.toBoolStr
print "'t' is empty? " + t.isEmpty.toBoolStr</syntaxhighlight>
 
{{out}}
<pre>'s' is empty? true
't' is empty? false
</pre>
 
885

edits