From: Roland Haeder Date: Fri, 7 Aug 2015 12:07:54 +0000 (+0200) Subject: Added convertNullToEmpty() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=20255f36e19b135d15897c89587c69fbff492c29;p=jcore.git Added convertNullToEmpty() Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index 7d96be8..8664591 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -800,4 +800,27 @@ public class BaseFrameworkSystem implements FrameworkInterface { // Return list iterator return map.entrySet().iterator(); } + + /** + * Converts null to empty string or leaves original string. + * + * @param str Any string + * @return Empty string if null or original string + */ + protected String convertNullToEmpty (final String str) { + // Trace message + this.getLogger().trace(MessageFormat.format("str={0}", str)); + + // Is it null? + if (str == null) { + // Return empty string + return ""; + } + + // Trace message + this.getLogger().trace(MessageFormat.format("str={0} - EXIT!", str)); + + // Return it + return str; + } }