Language

IEditable.Replace Method

Definition

Overloads

Name Description
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

The first buffer character offset to replace.

en
Int32

The exclusive end offset of the replaced buffer range.

text
ICharSequence

The source text used for the replacement.

Returns

This editable object after replacement and input-filter processing.

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

The first buffer character offset to replace.

en
Int32

The exclusive end offset of the replaced buffer range.

source
ICharSequence

The source text that contains the replacement range.

start
Int32

The first source character index to include.

end
Int32

The source index at which the replacement range stops, excluding that character.

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