diff options
| author | 2colours <polgar.marton@windowslive.com> | 2024-05-07 13:16:01 +0200 |
|---|---|---|
| committer | 2colours <polgar.marton@windowslive.com> | 2024-05-07 13:16:01 +0200 |
| commit | 66f3d07bccb32507f9dce910643ae3aaf7ad49e8 (patch) | |
| tree | e3c5fb36856908c9694540dd4b64b2c380c85df7 | |
| parent | 89a011ec4944063236e7869f52f56a88e11da769 (diff) | |
| download | perlweeklychallenge-club-66f3d07bccb32507f9dce910643ae3aaf7ad49e8.tar.gz perlweeklychallenge-club-66f3d07bccb32507f9dce910643ae3aaf7ad49e8.tar.bz2 perlweeklychallenge-club-66f3d07bccb32507f9dce910643ae3aaf7ad49e8.zip | |
Groovy: use replacements consistently
| -rw-r--r-- | challenge-268/2colours/groovy/ch-1.groovy | 6 | ||||
| -rw-r--r-- | challenge-268/2colours/groovy/ch-2.groovy | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/challenge-268/2colours/groovy/ch-1.groovy b/challenge-268/2colours/groovy/ch-1.groovy index acaac43654..385e3f776f 100644 --- a/challenge-268/2colours/groovy/ch-1.groovy +++ b/challenge-268/2colours/groovy/ch-1.groovy @@ -1,9 +1,9 @@ import groovy.json.JsonSlurper -final REPLACEMENTS = ['(': '[', ')': ']'] +final REPLACEMENTS = ['()', '[]'] def jsonSlurper = new JsonSlurper() -def x = jsonSlurper.parseText(System.console().readLine('@x = ').replace(REPLACEMENTS)) -def y = jsonSlurper.parseText(System.console().readLine('@y = ').replace(REPLACEMENTS)) +def x = jsonSlurper.parseText(System.console().readLine('@x = ').tr(*REPLACEMENTS)) +def y = jsonSlurper.parseText(System.console().readLine('@y = ').tr(*REPLACEMENTS)) x.sort() y.sort() diff --git a/challenge-268/2colours/groovy/ch-2.groovy b/challenge-268/2colours/groovy/ch-2.groovy index 667401cb24..5f679e77ac 100644 --- a/challenge-268/2colours/groovy/ch-2.groovy +++ b/challenge-268/2colours/groovy/ch-2.groovy @@ -1,7 +1,7 @@ import groovy.json.JsonSlurper import groovy.json.JsonOutput -final REPLACEMENTS = ['()', '[]']; +final REPLACEMENTS = ['()', '[]'] def jsonSlurper = new JsonSlurper() def ints = jsonSlurper.parseText(System.console().readLine('@ints = ').tr(*REPLACEMENTS)) |
