// Make left-to-right word-wrapped text into right-to-left text.
    public static string MakeWrappedStringRightToLeft(string strWrapped)
    {
        string[] strs = strWrapped.Split('\n');

        // Reverse each string.
        int stringCount = strs.Length;

        for (int i = 0; i < stringCount; ++i)
        {
            strs[i] = UtilGrapheme.ReverseGraphemeClusters(strs[i]);
            strs[i] = FixRightToLeftNumbers(strs[i]);
        }

        return(string.Join("\n", strs));
    }
    // Reverses the order of digits of each number in a string.
    // Used for fixing the order of digits for right-to-left text.
    // Might not work properly for strings that have newline characters.
    private static string FixRightToLeftNumbers(string str)
    {
        string[] strs = str.Split(' ');

        // Check if each "word" is a number, and if so, reverse its order.
        int stringCount = strs.Length;

        for (int i = 0; i < stringCount; ++i)
        {
            if (strs[i].Length != 0)
            {
                if (char.IsNumber(strs[i][0]))
                {
                    strs[i] = UtilGrapheme.ReverseGraphemeClusters(strs[i]);
                }
            }
        }

        return(string.Join(" ", strs));
    }