/// <summary> /// Reverse a Right-To-Left run of Unicode text. /// </summary> /// <param name="str">The RTL text.</param> /// <param name="options">Options for the reordering that control how the reordered text is written.</param> /// <returns>The reversed string</returns> public static string ReverseString(string str, CallReorderingOptions options) { if (str == null) { return(""); } var buff = new char[str.Length]; var len = NativeMethods.ubidi_writeReverse(str, str.Length, buff, buff.Length, (ushort)options, out var errorCode); ExceptionFromErrorCode.ThrowIfError(errorCode, "BiDi reversing failed! " + errorCode); return(new string(buff, 0, len)); }