Skip to content

Commit bba312b

Browse files
committed
Test on null value and new function isNull
1 parent f15f414 commit bba312b

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/java/com/scriptbasic/utility/functions/UtilityFunctions.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ static public Boolean isDefined(final Object s) {
8585
return s != null;
8686
}
8787

88+
/**
89+
* @param s is some value or object
90+
* @return true if the parameter is null
91+
*/
92+
@BasicFunction(classification = Utility.class)
93+
static public Boolean isNull(final Object s) {
94+
return s == null;
95+
}
96+
8897
/**
8998
* Create a new byte buffer of length {@code len}.
9099
*

src/test/resources/com/scriptbasic/testprograms/TestStringFunctions.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ assert("ltrim", ltrim(v)="1234 ")
99
assert("trim", trim(v)="1234")
1010
assert("rtrim", rtrim(v)=" 1234")
1111

12+
' Test null values
13+
assert("trim_with_null", IsNull(trim(xxx)))
14+
1215
' Test left, mid, right functions
1316
v = 1234
1417
assert("left_with_num", left(v,2)="12")

0 commit comments

Comments
 (0)