Skip to content

UTF8Reverse Sub-Module Documentation⚓︎


Overview⚓︎

A sub-module that contains a single function for reversing non-ASCII strings.

Functions⚓︎

UTF8Reveres⚓︎

Purpose⚓︎

This function takes a string Str as input and returns a new string with the words in the original string reversed in place.
The function is designed to handle unicode strings and uses the utf8 library to iterate through the graphemes1 in the input string.

Syntax⚓︎

UTF8Reverse(Str: string): string

Parameters⚓︎

  • Str: string
    The utf-8 string to reverse its words.

Returns⚓︎

  • string
    The reversed input string.

Examples⚓︎

1
2
3
4
5
6
print(String.UTF8Reverse("Hello, World!"))
print(String.UTF8Reverse("ومرحباً! أهلاً"))
print(String.UTF8Reverse("Ābāc ꜜ"))
print(String.UTF8Reverse("🌍🌏🌎"))
print(String.UTF8Reverse("こんにちは! 世界。 これはテスト文字列です。"))
print(String.UTF8Reverse("す。れべデンタセット れ わせ 世界。 !はちにんこ"))
1
2
3
4
5
6
!World Hello,
أهلاً ومرحباً!        -- "!" Character should be at the end and not like that.
 Ābāc
🌍🌏🌎
これはテスト文字列です。 世界。 こんにちは!
す。れべデンタセット  わせ 世界。 !はちにんこ

  1. A combination of one or more characters that form a single visual entity.