語言

IEditable.Replace 方法

定義

多載

名稱 Description
Replace(Int32, Int32, ICharSequence)

替換的便利性(st, en, text, 0, text.length())

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

將本可編輯檔案中指定的文字範圍st…en()替換為來自 的切片start…endsource副本。

Replace(Int32, Int32, ICharSequence)

替換的便利性(st, en, text, 0, text.length())

[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

參數

st
Int32

要替換的第一個緩衝區字元偏移量。

en
Int32

被替換緩衝區範圍的專屬端偏移量。

text
ICharSequence

用於替換的原始文字。

傳回

此可編輯物件,經過替換與輸入篩選器處理後。

屬性

備註

替換的便利性(st, en, text, 0, text.length())

Java 文件 android.text.Editable.replace(int, int, java.lang.CharSequence)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

另請參閱

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

適用於

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

將本可編輯檔案中指定的文字範圍st&hellip;en()替換為來自 的切片start&hellip;endsource副本。

[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

參數

st
Int32

要替換的第一個緩衝區字元偏移量。

en
Int32

被替換緩衝區範圍的專屬端偏移量。

source
ICharSequence

包含替換範圍的來源文字。

start
Int32

首個包含的原始角色索引。

end
Int32

替換範圍終止的來源索引,但不包含該字元。

傳回

這是對這個物件的致敬。

屬性

備註

將本可編輯檔案中指定的文字範圍st&hellip;en()替換為來自 的切片start&hellip;endsource副本。 目的切片可能是空的,此時操作為插入;或來源切片為空,則為刪除。

在提交變更前,每個已設定的 #setFilters 過濾器都有機會修改文字內容 source 。

若 source 是 spaneded,則其跨度會被保留到 Editable。 Editable 內現有且完全涵蓋被替換範圍的跨度會保留,但嚴格屬於被替換範圍的跨度則被移除。 若 包含 source 帶有 Spanned#SPAN_PARAGRAPH 標誌的跨度,且不符合段落邊界限制,則不保留。 作為特殊情況,即使整個游標所在範圍被替換,游標位置仍會被保留。

Java 文件 android.text.Editable.replace(int, int, java.lang.CharSequence, int, int)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於