[jira] [Commented] (LANG-1345) Add methods to enhance non-empty strings
[ https://issues.apache.org/jira/browse/LANG-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17231201#comment-17231201 ] Arturo Bernal commented on LANG-1345: - H [~ggregory] 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. [https://github.com/apache/commons-lang/pull/646] > 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)
[jira] [Commented] (LANG-1345) Add methods to enhance non-empty strings
[ https://issues.apache.org/jira/browse/LANG-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17091139#comment-17091139 ] Mitth'raw'nuruodo commented on LANG-1345: - The latest iteration simply has methods similar to the existing {{appendIfMissing}} and {{prependIfMissing}}. Those add a text segment if it wasn't already present; the new ones add a text segment if the base string isn't empty/blank. > 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 > Remaining Estimate: 24h > > 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)
[jira] [Commented] (LANG-1345) Add methods to enhance non-empty strings
[ https://issues.apache.org/jira/browse/LANG-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16156153#comment-16156153 ] Sebb commented on LANG-1345: Sorry, but I think this is straying far beyond the remit of the LANG library. It's probably also not appropriate for the TEXT library. IMO this sort of code belongs in the application. > 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 > Remaining Estimate: 24h > > 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 (v6.4.14#64029)
[jira] [Commented] (LANG-1345) Add methods to enhance non-empty strings
[ https://issues.apache.org/jira/browse/LANG-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16090790#comment-16090790 ] ASF GitHub Bot commented on LANG-1345: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/278 [![Coverage Status](https://coveralls.io/builds/12432196/badge)](https://coveralls.io/builds/12432196) Coverage increased (+0.0006%) to 95.168% when pulling **e89ca5ceb5dfbb5e2b94a9f5497c28ecf8c65973 on ThrawnCA:LANG-1345-enhance-non-empty-strings** into **187a05b8a4db364af9d1c8ff4eb422082c30a1ff on apache:master**. > 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 > Remaining Estimate: 24h > > As a corollary to {{defaultString}} 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 (v6.4.14#64029)