Empty string: Difference between revisions
removed langur language example for now
m (→{{header|Wren}}: Changed to Wren S/H) |
Langurmonkey (talk | contribs) (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:
(defvar str "" "An empty string")
(if (length= str 0)
(message "string is empty")
(message "string is not empty"))
=={{header|EMal}}==
Line 1,882 ⟶ 1,891:
fn.println(parser.op(@$s > 0))
</syntaxhighlight>
=={{header|langur}}==▼
▲<syntaxhighlight lang="langur">val .zls = ""
▲writeln len(.zls)</syntaxhighlight>
{{out}}▼
<pre>true▼
=={{header|Lasso}}==
Line 2,176 ⟶ 2,173:
true
false
{{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>
|