rosetta code: empty_string
authorJean Privat <jean@pryen.org>
Mon, 7 Mar 2016 20:31:26 +0000 (15:31 -0500)
committerJean Privat <jean@pryen.org>
Wed, 23 Mar 2016 20:07:17 +0000 (16:07 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

examples/rosettacode/empty_string.nit [new file with mode: 0644]
tests/sav/empty_string.res [new file with mode: 0644]

diff --git a/examples/rosettacode/empty_string.nit b/examples/rosettacode/empty_string.nit
new file mode 100644 (file)
index 0000000..8848c8e
--- /dev/null
@@ -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: <http://rosettacode.org/wiki/Empty_string>
+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 (file)
index 0000000..405c2a9
--- /dev/null
@@ -0,0 +1,3 @@
+Is empty
+Is empty
+Is empty