Empty string: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
(→{{header|Diego}}: Added Diego entry) |
||
Line 1,048: | Line 1,048: | ||
Writeln(StringIsEmpty(s)); // False |
Writeln(StringIsEmpty(s)); // False |
||
end.</lang> |
end.</lang> |
||
=={{header|Diego}}== |
|||
Assign an empty string to variable <code>s</code>. |
|||
<lang diego>add_str(s,⟦⟧); // empty string |
|||
add_str(n); // null string (␀)</lang> |
|||
Check a string is empty (various approaches). |
|||
<lang diego>add_str(es,⟦⟧); |
|||
add_bool(isEmpty) |
|||
()_check⟦[es]==⟦⟧⟧; |
|||
()_if⟦[es]≍⟦⟧⟧; |
|||
()_calc({bool},⟦[es]==⟦⟧⟧); |
|||
()_test⟦[lens]≍0⟧_lento(lens,⟦[es]⟧); |
|||
()_is⟦[lens]>0⟧_lento(lens,⟦[es]⟧); |
|||
()_check⟦[es]===({str},⟦⟧)⟧; |
|||
()_if⟦[es]≡({str},⟦⟧)⟧; |
|||
()_calc⟦≣[es]⟧_forme()_forall(); |
|||
()_not⟦[es]≠⟦⟧⟧; |
|||
()_not()_bool[es]; |
|||
()_empty[es]; |
|||
(es)_equal⟦⟦⟧⟧; |
|||
; |
|||
log_console()_(isEmpty); |
|||
log_console()_is(es); // is not null</lang> |
|||
{{out}} |
|||
<pre>true,true,true,true,true,true,true,true,true,true,true,true |
|||
true</pre> |
|||
Check a string is not empty (various approaches). |
|||
<lang diego>add_str(s,⟦text⟧); |
|||
add_bool(isNotEmpty) |
|||
()_check⟦[s]!=⟦⟧⟧; |
|||
()_if⟦[s]≭⟦⟧⟧; |
|||
()_calc({bool},⟦[s]≠⟦⟧⟧); |
|||
()_test⟦[lens]≠0⟧_lento(lens,⟦[s]⟧); |
|||
()_is⟦[lens]<0⟧_lento(lens,⟦[s]⟧); |
|||
()_check⟦[s]!==({str},⟦⟧)⟧; |
|||
()_if⟦[s]≢({str},⟦⟧)⟧; |
|||
()_calc⟦!≣[s]⟧_forme()_forany(); |
|||
()_bool[s]; |
|||
()_not()_empty[s]; |
|||
(s)_notequal⟦⟦⟧⟧; |
|||
; |
|||
log_console()_(isNotEmpty); |
|||
log_console()_is(s); // is not null</lang> |
|||
{{out}} |
|||
<pre>true,true,true,true,true,true,true,true,true,true,true |
|||
true</pre> |
|||
Check a string is <code>null</code> (␀) (various approaches). |
|||
<lang diego>add_str(n); |
|||
add_bool(isNull) |
|||
()_check⟦![n]⟧; |
|||
()_calc({bool},⟦¬[n]⟧); |
|||
()_isnull[n]; |
|||
()_not[n]; |
|||
()_isnull()_bool[n]; |
|||
()_none[n]; |
|||
()_any[n]_forme(); |
|||
(n)_equal⟦␀⟧; |
|||
; |
|||
log_console()_(isNull);</lang> |
|||
{{out}} |
|||
<pre>true,true,true,true,true,true,true,true</pre> |
|||
=={{header|DWScript}}== |
=={{header|DWScript}}== |