共用方式為


Bidi.GetLogicalIndex(Int32) Method

Definition

Get the logical text position from a visual position.

[Android.Runtime.Register("getLogicalIndex", "(I)I", "GetGetLogicalIndex_IHandler", ApiSince=29)]
public virtual int GetLogicalIndex (int visualIndex);
[<Android.Runtime.Register("getLogicalIndex", "(I)I", "GetGetLogicalIndex_IHandler", ApiSince=29)>]
abstract member GetLogicalIndex : int -> int
override this.GetLogicalIndex : int -> int

Parameters

visualIndex
Int32

is the visual position of a character.

Returns

The index of this character in the text.

Attributes

Remarks

Get the logical text position from a visual position. If such a mapping is used many times on the same Bidi object, then calling getVisualMap() is more efficient.

The value returned may be MAP_NOWHERE if there is no logical position because the corresponding text character is a Bidi mark inserted in the output by option OPTION_INSERT_MARKS.

This is the inverse method to getVisualIndex().

When the visual output is altered by using options of writeReordered() such as INSERT_LRM_FOR_NUMERIC, KEEP_BASE_COMBINING, OUTPUT_REVERSE, REMOVE_BIDI_CONTROLS, the logical position returned may not be correct. It is advised to use, when possible, reordering options such as #OPTION_INSERT_MARKS and #OPTION_REMOVE_CONTROLS.

Java documentation for android.icu.text.Bidi.getLogicalIndex(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to