You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/11/13 06:46:00 UTC
[jira] [Work logged] (LANG-1345) Add methods to enhance non-empty
strings
[ https://issues.apache.org/jira/browse/LANG-1345?focusedWorklogId=511229&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-511229 ]
ASF GitHub Bot logged work on LANG-1345:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Nov/20 06:45
Start Date: 13/Nov/20 06:45
Worklog Time Spent: 10m
Work Description: arturobernalg commented on pull request #646:
URL: https://github.com/apache/commons-lang/pull/646#issuecomment-726557310
I really like this method and the proposal. I think it is quite useful and should be included in the next version. I create the PR with the name change proposal.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Issue Time Tracking
-------------------
Worklog Id: (was: 511229)
Remaining Estimate: 23h 40m (was: 23h 50m)
Time Spent: 20m (was: 10m)
> 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
> Original Estimate: 24h
> Time Spent: 20m
> Remaining Estimate: 23h 40m
>
> As a corollary to {{defaultString}}, {{appendIfMissing}}, and similar methods, which allow 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
> {code}
> if (StringUtils.isNotEmpty(queryString)) {
> return url + "?" + queryString;
> } else {
> return url;
> }
> {code}
> would become:
> {code}
> return url + StringUtils.addIfNotEmpty(queryString, "?", null);
> {code}
> with the second parameter being the prefix, and the third, the suffix. If the string is null or empty, return empty string.
> If this could accept arbitrary transformation functions, it could effectively become the Elvis operator.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)