Class TextSearchResults
Represents the TextSearchResults class.
Inheritance
Namespace: Syncfusion.UI.Xaml.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.UWP.dll
Syntax
public class TextSearchResults : Object
Properties
Count
Gets the count of the TextSearchResults.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The count of the TextSearchResults. |
Item[Int32]
Gets the TextSearchResult instance at the specified index
.
Declaration
public TextSearchResult this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the TextSearchResult instance to get. |
Property Value
Type | Description |
---|---|
TextSearchResult | The instance of the TextSearchResult at the specified |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Index was out of range. Must be non-negative and less than the size of the collection. |
Methods
Dispose()
Releases all the resources used by this TextSearchResults instance.
Declaration
public void Dispose()
Replace(String)
Replaces the first occurrence of the TextSearchResults with the specified System.String.
Declaration
public int Replace(string replaceText)
Parameters
Type | Name | Description |
---|---|---|
System.String | replaceText | The text to replace with. |
Returns
Type | Description |
---|---|
System.Int32 | Returns one, if the first occurrence of the TextSearchResults is replaced successfully with the specified System.String. Otherwise returns zero. |
Remarks
The replace operation cannot be performed in read only mode.
Examples
The following code example demonstrates how to replace the first occurence of an existing text in SfRichTextBoxAdv.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv"/>
public void ReplaceFirstOccurrenceOfText()
{
// Performs case sensitive search for the text "colour" that also matches whole word in the document.
TextSearchResults textSearchResults = richTextBoxAdv.FindAll("colour", FindOptions.CaseSensitiveWholeWord);
// If any text search results found, replaces the first occurrence with the text "color".
if (textSearchResults != null)
textSearchResults.Replace("color");
}
Public Sub ReplaceFirstOccurrenceOfText()
' Performs case sensitive search for the text "colour" that also matches whole word in the document.
Dim textSearchResults As TextSearchResults = richTextBoxAdv.FindAll("colour", FindOptions.CaseSensitiveWholeWord)
' If any text search results found, replaces the first occurrence with the text "color".
If textSearchResults IsNot Nothing Then
textSearchResults.Replace("color")
End If
End Sub
ReplaceAll(String)
Replaces all the occurrences of the TextSearchResults with the specified System.String.
Declaration
public int ReplaceAll(string replaceText)
Parameters
Type | Name | Description |
---|---|---|
System.String | replaceText | The text to replace with. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the number of TextSearchResult replaced successfully. If no TextSearchResult is replaced, then returns zero. |
Remarks
The replace operation cannot be performed in read only mode.
Examples
The following code example demonstrates how to replace all the occurrences of an existing text in SfRichTextBoxAdv.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv"/>
public void ReplaceAllOccurrencesOfText()
{
// Performs case sensitive search for the text "colour" that also matches whole word in the document.
TextSearchResults textSearchResults = richTextBoxAdv.FindAll("colour", FindOptions.CaseSensitiveWholeWord);
// If any text search results found, replaces all the occurrences with the text "color".
if (textSearchResults != null)
textSearchResults.ReplaceAll("color");
}
Public Sub ReplaceAllOccurrencesOfText()
' Performs case sensitive search for the text "colour" that also matches whole word in the document.
Dim textSearchResults As TextSearchResults = richTextBoxAdv.FindAll("colour", FindOptions.CaseSensitiveWholeWord)
' If any text search results found, replaces all the occurrences with the text "color".
If textSearchResults IsNot Nothing Then
textSearchResults.ReplaceAll("color")
End If
End Sub