From 642afc96a0742160068e5c34aed2e54d76eb43fa Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 7 Mar 2016 15:31:26 -0500 Subject: [PATCH] rosetta code: empty_string Signed-off-by: Jean Privat --- examples/rosettacode/empty_string.nit | 18 ++++++++++++++++++ tests/sav/empty_string.res | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 examples/rosettacode/empty_string.nit create mode 100644 tests/sav/empty_string.res 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 -- 1.7.9.5