groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <>
Subject [jira] [Commented] (GROOVY-7540) Add StringGroovyMethods.collectReplacements(String, Map)
Date Thu, 06 Aug 2015 11:07:05 GMT


Paul King commented on GROOVY-7540:

The regex idea was simply to align with existing {{replaceAll}} functionality but I don't
think that is what you are after. I think String#replace will be the closest existing match
to what you want (it works for just one source/target pair CharSequence - ignoring the char
variant). We could provide a Map variant with keys and values being CharSequence or String
and the ordering determined by the natural ordering of the keys for the Map - hence best to
use something like LinkedHashMap (the default Map for Groovy).

> Add StringGroovyMethods.collectReplacements(String, Map)
> --------------------------------------------------------
>                 Key: GROOVY-7540
>                 URL:
>             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

View raw message