-
Notifications
You must be signed in to change notification settings - Fork 5
String functions (trim, left, right, mid) - supports non string parameter #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String functions (trim, left, right, mid) - supports non string parameter #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes, mainly formatting. Other than that genius and also thanks for catching possible NPE-s. It would be nice to have some unit test that covers the execution branch when the Object o is null.
src/main/java/com/scriptbasic/utility/functions/StringFunctions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/scriptbasic/utility/functions/StringFunctions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/scriptbasic/utility/functions/StringFunctions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/scriptbasic/utility/functions/StringFunctions.java
Outdated
Show resolved
Hide resolved
|
Thank you for your suggestions. I added test on null and also two new functions (CStr and IsNull). If you will have a minute please review the changes..... |
44c28eb to
c8eb9ac
Compare
| com.scriptbasic.classification.Utility.class}) | ||
| static public String ltrim(final String s) { | ||
| static public String ltrim(final Object o) throws BasicRuntimeException { | ||
| if(o==null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use proper formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting was fixed.
| assert("rtrim", rtrim(v)=" 1234") | ||
|
|
||
| ' Test null values | ||
| assert("ltrim_with_null", IsNull(ltrim(xxx))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of xxx you could use undef. More expressive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed variable name.
c8eb9ac to
1666063
Compare
String functions (trim, left, right, mid) - supports null parameter and numerical parameter, improved VB/VBA compatibility