Empty string: Difference between revisions

Content added Content deleted
Line 803: Line 803:
if length(s) = 0 then ... /* To test whether a string is empty */
if length(s) = 0 then ... /* To test whether a string is empty */
if length(s) > 0 then ... /* to test for a non-empty string */
if length(s) > 0 then ... /* to test for a non-empty string */
</lang>

=={{header|Prolog}}==
{{works with|SWI-Prolog|7}}
<lang prolog>assign_empty_string(Variable) :- Variable = "".

is_empty_string(String) :- String == "".
not_empty_string(String) :- String \== "".
</lang>
</lang>