Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming.
For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance.
Your task is to reverse a given string.
Some examples:
"stressed"
into "desserts"
."strops"
into "sports"
."racecar"
into "racecar"
.Preserve grapheme clusters, i.e.
myreverse("hi ๐๐พ") == "๐๐พ ih"
myreverse("asโdfฬ
") == "fฬ
dsโa"
You will probably find the Unicode
stdlib useful for this bonus task.
To enable the graphemes test, add const TEST_GRAPHEMES = true
to the global scope of your file.
Sign up to Exercism to learn and master Julia with 82 exercises, and real human mentoring, all for free.
Explore 14 different ways to reverse a string, exploring a range of topics including Unicode Codepoints, Graphemes, Stack vs Heap allocations, and pointers. Kick back and enjoy 45mins of learning with Jeremy and Erik.