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

Jochen Kemnade edited comment on GROOVY-7540 at 8/5/15 6:41 AM:
----------------------------------------------------------------

Yes, of course, there are ways to do it, but I'd like to do it as efficiently 
as possible. I've ended up delegating to 
{{org.apache.commons.lang3.StringUtils.replaceEach(String, String[], 
String[])}}.
I think the {{collectReplacements}} with a closure needs to work 
character-wise. Making it work with multi-character strings would be quite 
complicated to implement and to use as well.


was (Author: jkemnade):
Yes, of course, there are ways to do it. I've ended up delegating to 
{{org.apache.commons.lang3.StringUtils.replaceEach(String, String[], 
String[])}}.
I think the {{collectReplacements}} with a closure needs to work 
character-wise. Making it work with multi-character strings would be quite 
complicated to implement and to use as well.

> Add StringGroovyMethods.collectReplacements(String, Map)
> --------------------------------------------------------
>
>                 Key: GROOVY-7540
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7540
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Jochen Kemnade
>            Priority: Minor
>
> It should be possible to use a map with {{collectReplacements}}, like in
> {code}
> "f006ar".collectReplacements(["0":"o", "6":"b"])
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to