Partager via


String.CodePointBefore(Int32) Method

Definition

Returns the character (Unicode code point) before the specified index.

[Android.Runtime.Register("codePointBefore", "(I)I", "")]
public int CodePointBefore (int index);
[<Android.Runtime.Register("codePointBefore", "(I)I", "")>]
member this.CodePointBefore : int -> int

Parameters

index
Int32

the index following the code point that should be returned

Returns

the Unicode code point value before the given index.

Attributes

Exceptions

if index length()

Remarks

Returns the character (Unicode code point) before the specified index. The index refers to char values (Unicode code units) and ranges from 1 to CharSequence#length() length.

If the char value at (index - 1) is in the low-surrogate range, (index - 2) is not negative, and the char value at (index - 2) is in the high-surrogate range, then the supplementary code point value of the surrogate pair is returned. If the char value at index - 1 is an unpaired low-surrogate or a high-surrogate, the surrogate value is returned.

Added in 1.5.

Java documentation for java.lang.String.codePointBefore(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

See also

  • <xref:Java.Lang.Character.CodePointBefore(System.Char%5b%5d%2c+System.Int32%2c+System.Int32)>