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

Paul King commented on GROOVY-7540:
-----------------------------------

I am not necessarily saying the request is invalid as a whole - just playing 
devil's advocate to ensure that we don't introduce unnecessary duplicate 
methods and where we do introduce additional functionality, that we name it in 
a consistent fashion.

I am thinking the single character case is handled well enough with {{tr}} but 
the multi-string case is indeed functionality we can only replicate in several 
steps. so there is possibly a useful {{replaceAll}} method taking a map that we 
could add.

There are questions to answer though, like should the method be regex aware and 
as per your earlier comment, are the transformations sequential in nature (the 
'bar' and 'baz') alternatives and if so would we force the map to be say a 
LinkedHashMap or only guarantee particular behavior if such a map was supplied?

> 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