commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-875) StringUtils: Include methods for appending suffix or prepending a prefix if not already present
Date Tue, 09 Apr 2013 05:38:17 GMT

    [ https://issues.apache.org/jira/browse/LANG-875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13626256#comment-13626256
] 

Henri Yandell commented on LANG-875:
------------------------------------

Patch applies cleanly and tests pass.

Methods are:

 appendIfMissing(final String str, final CharSequence suffix)
 appendIfMissingAny(final String str, final CharSequence suffix, final CharSequence... suffixes)
 appendIfMissingIgnoreCase(final String str, final CharSequence suffix)
 appendIfMissingAnyIgnoreCase(final String str, final CharSequence suffix, final CharSequence...
suffixes)
 prependIfMissing(final String str, final CharSequence prefix)
 prependIfMissingAny(final String str, final CharSequence prefix, final CharSequence... prefixes)
 prependIfMissingIgnoreCase(final String str, final CharSequence prefix)
 prependIfMissingAnyIgnoreCase(final String str, final CharSequence prefix, final CharSequence...
prefixes)

Is there any reason to have the Any methods? ie) Why not just have    appendIfMissing(String,
CharSequence, CharSequence...)?

                
> StringUtils: Include methods for appending suffix or prepending a prefix if not already
present
> -----------------------------------------------------------------------------------------------
>
>                 Key: LANG-875
>                 URL: https://issues.apache.org/jira/browse/LANG-875
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Joanne Polsky
>            Priority: Minor
>             Fix For: 3.x
>
>         Attachments: LANG-875.patch
>
>
> StringUtils has various methods to checking and removing a substring from the start/end
of a string but nothing for appending.  These methods will append a suffix to the end or prepend
a prefix to the start of the string if not already present.
> The methods would include:
> - appendIfMissing
> - appendIfMissingAny
> - appendIfMissingIgnoreCase
> - appendIfMissingAnyIgnoreCase
> - prependIfMissing
> - prependIfMissingAny
> - prependIfMissingIgnoreCase
> - prependIfMissingAnyIgnoreCase

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message