From: Jean Privat Date: Mon, 7 Mar 2016 20:31:26 +0000 (-0500) Subject: rosetta code: empty_string X-Git-Url: http://nitlanguage.org rosetta code: empty_string Signed-off-by: Jean Privat --- diff --git a/examples/rosettacode/empty_string.nit b/examples/rosettacode/empty_string.nit new file mode 100644 index 0000000..8848c8e --- /dev/null +++ b/examples/rosettacode/empty_string.nit @@ -0,0 +1,18 @@ +#!/usr/bin/env nit +# +# This file is part of NIT ( http://www.nitlanguage.org ). +# This program is public domain + +# Task: Empty_string +# SEE: +module empty_string + +var s = "" + +if s.is_empty then print "Is empty" +if s == "" then print "Is empty" +if s.length == 0 then print "Is empty" + +if not s.is_empty then print "Not empty" +if s != "" then print "Not empty" +if s.length > 0 then print "Not empty" diff --git a/tests/sav/empty_string.res b/tests/sav/empty_string.res new file mode 100644 index 0000000..405c2a9 --- /dev/null +++ b/tests/sav/empty_string.res @@ -0,0 +1,3 @@ +Is empty +Is empty +Is empty