Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 41: Reverse a string

See programming-idioms.org:

Code

There is no feature in Fuzion's strings to reverse the characters, so we have to do it manually: First, the string that is usually represented as utf8 is converted to an array of codepoints. This array is then reversed and folded back into a string using string's concat monoid.

Running Example

Since this example reverse the codepoints and not bytes or utf16 chars, this also works for unicode chars outside the basic plane: