Skip to content
Snippets Groups Projects
Commit c2fc0ba5 authored by tpylak's avatar tpylak
Browse files

minor: add useful method to common (for future)

SVN: 7600
parent ebed2571
No related branches found
No related tags found
No related merge requests found
...@@ -207,4 +207,19 @@ public final class StringUtilities ...@@ -207,4 +207,19 @@ public final class StringUtilities
} }
return number + "th"; return number + "th";
} }
/** compares two strings which can be null. Null is smaller than not-null string. */
public static int compareNullable(String s1OrNull, String s2OrNull)
{
if (s1OrNull == null)
{
return s2OrNull == null ? 0 : -1;
} else if (s2OrNull == null)
{
return 1;
} else
{
return s1OrNull.compareTo(s2OrNull);
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment