2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
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