共用方式為


IEditable.Replace Method

Definition

Overloads

Replace(Int32, Int32, ICharSequence)

Convenience for replace(st, en, text, 0, text.

Replace(Int32, Int32, ICharSequence, Int32, Int32)

Replaces the specified range (st…en) of text in this Editable with a copy of the slice start…end from source.

Replace(Int32, Int32, ICharSequence)

Convenience for replace(st, en, text, 0, text.

[Android.Runtime.Register("replace", "(IILjava/lang/CharSequence;)Landroid/text/Editable;", "GetReplace_IILjava_lang_CharSequence_Handler:Android.Text.IEditableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Text.IEditable? Replace (int st, int en, Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("replace", "(IILjava/lang/CharSequence;)Landroid/text/Editable;", "GetReplace_IILjava_lang_CharSequence_Handler:Android.Text.IEditableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Replace : int * int * Java.Lang.ICharSequence -> Android.Text.IEditable

Parameters

st
Int32
en
Int32

Returns

Attributes

Remarks

Convenience for replace(st, en, text, 0, text.length())

Java documentation for android.text.Editable.replace(int, int, java.lang.CharSequence).

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.

See also

  • <xref:Android.Text.IEditable.Replace(System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32)>

Applies to

Replace(Int32, Int32, ICharSequence, Int32, Int32)

Replaces the specified range (st&hellip;en) of text in this Editable with a copy of the slice start&hellip;end from source.

[Android.Runtime.Register("replace", "(IILjava/lang/CharSequence;II)Landroid/text/Editable;", "GetReplace_IILjava_lang_CharSequence_IIHandler:Android.Text.IEditableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Text.IEditable? Replace (int st, int en, Java.Lang.ICharSequence? source, int start, int end);
[<Android.Runtime.Register("replace", "(IILjava/lang/CharSequence;II)Landroid/text/Editable;", "GetReplace_IILjava_lang_CharSequence_IIHandler:Android.Text.IEditableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Replace : int * int * Java.Lang.ICharSequence * int * int -> Android.Text.IEditable

Parameters

st
Int32
en
Int32
source
ICharSequence
start
Int32
end
Int32

Returns

a reference to this object.

Attributes

Remarks

Replaces the specified range (st&hellip;en) of text in this Editable with a copy of the slice start&hellip;end from source. The destination slice may be empty, in which case the operation is an insertion, or the source slice may be empty, in which case the operation is a deletion.

Before the change is committed, each filter that was set with #setFilters is given the opportunity to modify the source text.

If source is Spanned, the spans from it are preserved into the Editable. Existing spans within the Editable that entirely cover the replaced range are retained, but any that were strictly within the range that was replaced are removed. If the source contains a span with Spanned#SPAN_PARAGRAPH flag, and it does not satisfy the paragraph boundary constraint, it is not retained. As a special case, the cursor position is preserved even when the entire range where it is located is replaced.

Java documentation for android.text.Editable.replace(int, int, java.lang.CharSequence, int, 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