Empty string: Difference between revisions
Content added Content deleted
(Forth) |
(added Fantom example) |
||
Line 120: | Line 120: | ||
-- string is not empty |
-- string is not empty |
||
end if</lang> |
end if</lang> |
||
=={{header|Fantom}}== |
|||
Fantom uses "" to represent an empty string, and provides the isEmpty method to check if a string is empty. |
|||
<lang fantom> |
|||
a := "" // assign an empty string to 'a' |
|||
a.isEmpty // method on sys::Str to check if string is empty |
|||
a.size == 0 // what isEmpty actually checks |
|||
a == "" // alternate check for an empty string |
|||
!a.isEmpty // check that a string is not empty |
|||
</lang> |
|||
=={{header|Forth}}== |
=={{header|Forth}}== |