You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mitth'raw'nuruodo (JIRA)" <ji...@apache.org> on 2017/07/11 05:22:00 UTC

[jira] [Created] (LANG-1345) Add methods to enhance non-empty strings

Mitth'raw'nuruodo created LANG-1345:
---------------------------------------

             Summary: Add methods to enhance non-empty strings
                 Key: LANG-1345
                 URL: https://issues.apache.org/jira/browse/LANG-1345
             Project: Commons Lang
          Issue Type: Improvement
          Components: lang.*
            Reporter: Mitth'raw'nuruodo
            Priority: Minor


As a corollary to {{defaultString}} and similar methods, allowing the client to replace a missing string with something, it would sometimes be helpful to have methods that enhance a string, if it is present, with a prefix and suffix (or perhaps with an arbitrary function).

Eg

    if (StringUtils.isNotEmpty(suffix)) {
        return message + ", " + suffix;
    } else {
        return message;
    }

would become:

    return message + StringUtils.addIfNotEmpty(suffix, ", ", null);



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)