/// <summary> /// Returns a reordered string for a piece of text (one or more paragraphs) set by <see cref="SetPara(string, byte, byte[])"/> or /// for a line of text set by <see cref="SetLine(int, int)"/>. /// </summary> /// <param name="options">Options for the reordering that control how the reordered text is written.</param> /// <returns>The reordered string</returns> public string GetReordered(CallReorderingOptions options) { var buff = new char[ProcessedLength * 2]; var len = NativeMethods.ubidi_writeReordered(_biDi, buff, buff.Length * 2, (ushort)options, out var errorCode); ExceptionFromErrorCode.ThrowIfError(errorCode, "BiDi reordering failed! " + errorCode); return(new string(buff, 0, len)); }
/// <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)); }