commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Woonsan Ko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-893) Default value for StrSubstitutor
Date Wed, 18 Sep 2013 00:57:52 GMT

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

Woonsan Ko commented on LANG-893:
---------------------------------

Hi Olivier,

Thank you very much for picking up this issue!
Yes, the test file seems to have been modified since the patch uploaded.
So, I created a new patch from the latest update and uploaded:
- default-value-operation-new.patch

Probably it will work, but just in case, I also uploaded the two java files as well:
- src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
- src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java

Thanks in again and cheers!

Woonsan
                
> 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-new.patch, default-value-operation.patch,
StrSubstitutor.java, StrSubstitutorTest.java
>
>
> 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

Mime
View raw message