[ https://issues.apache.org/jira/browse/GROOVY-7540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14661683#comment-14661683 ]
Paul King commented on GROOVY-7540: ----------------------------------- Yes, groovyTestCase is a nice feature. There is a rather complicated guess at StringBuilder size in the Apache method which I didn't carry over and a worse case guess could easily consume large amounts of memory. There might be a compromise approach - perhaps something as simple as checking if any replacement is bigger than the original and if so, add (say) 20% otherwise just use the original size. The early returns are well catered for - once at the beginning and then a boolean array allows pairs to be ignored once they become irrelevant. > Add a method to StringGroovyMethods for replacing String pairs supplied as a > 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)