You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2013/09/17 22:03:52 UTC
[jira] [Commented] (LANG-893) Default value for StrSubstitutor
[ https://issues.apache.org/jira/browse/LANG-893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13769858#comment-13769858 ]
Oliver Heger commented on LANG-893:
-----------------------------------
Hi Woonsan,
sorry for the late response. I had a look at the patch, and it is very good - especially the set of additional unit tests.
However, I have trouble with applying it. While it applies without problems for {{StrSubstitutor.java}}, Eclipse cannot match the test file. Could you please recheck? Maybe there have been some changes in the meantime?
Thank you very much for your contribution!
> Default value for StrSubstitutor
> --------------------------------
>
> Key: LANG-893
> URL: https://issues.apache.org/jira/browse/LANG-893
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.text.*
> Affects Versions: 2.4
> Reporter: Lauri Siltanen
> Priority: Minor
> Attachments: default-value-operation.patch
>
>
> public static void main(String[] args) {
> String s = "The number of ${item} items currently available: ${number}";
> String result = StrSubstitutor.replace(s, Collections.singletonMap("item", "monitor"));
> System.out.println(result);
> }
> This results in: "The number of monitor items currently available: ${number}".
> I'd need a default value for a placeholder that cannot be resolved.
> String result = StrSubstitutor.replace(s, Collections.singletonMap("item", "monitor"), "N/A");
> -> "The number of monitor items currently available: N/A".
--
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