Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
1
Task/Reverse-a-string/Groovy/reverse-a-string-1.groovy
Normal file
1
Task/Reverse-a-string/Groovy/reverse-a-string-1.groovy
Normal file
|
|
@ -0,0 +1 @@
|
|||
println "Able was I, 'ere I saw Elba.".reverse()
|
||||
15
Task/Reverse-a-string/Groovy/reverse-a-string-2.groovy
Normal file
15
Task/Reverse-a-string/Groovy/reverse-a-string-2.groovy
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
def string = "as⃝df̅"
|
||||
|
||||
List combiningBlocks = [
|
||||
Character.UnicodeBlock.COMBINING_DIACRITICAL_MARKS,
|
||||
Character.UnicodeBlock.COMBINING_DIACRITICAL_MARKS_SUPPLEMENT,
|
||||
Character.UnicodeBlock.COMBINING_HALF_MARKS,
|
||||
Character.UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS
|
||||
]
|
||||
List chars = string as List
|
||||
chars[1..-1].eachWithIndex { ch, i ->
|
||||
if (Character.UnicodeBlock.of((char)ch) in combiningBlocks) {
|
||||
chars[i..(i+1)] = chars[(i+1)..i]
|
||||
}
|
||||
}
|
||||
println chars.reverse().join()
|
||||
Loading…
Add table
Add a link
Reference in a new issue