ITextRange.FindText method

Applies to Windows and Windows Phone

Searches for a particular text string in a range and, if found, selects the string.

Syntax


int FindText(
  string value, 
  int scanLength, 
  FindOptions options
)

Parameters

value

Type: System.String [.NET] | Platform::String [C++]

The text string to search for.

scanLength

Type: System.Int32 [.NET] | int32 [C++]

The maximum number of characters to search. It can be one of the following.

ValueMeaning
TextConstants.MaxUnitCount

Searches to the end of the story. This is the default value.

n (greater than 0)

The search is forward for n characters beginning with the first character in the text range. If the text range itself matches the value string, this method attempts another search beginning with the second character in the text range.

n (less than 0)

The search is backward for n characters, beginning with the last character in the text range. If the text range itself matches the value string, the method attempts another search beginning with the second-to-last character in the text range.

0 (degenerate range)

The search begins after the text range.

0 (nondegenerate range)

The search is limited to the text range.

 

In all cases, if a string is found, the range limits are changed to be those of the matched string and FindText returns the length of the string. If the string is not found, the range remains unchanged and FindText returns zero.

options

Type: FindOptions

The options to use when doing the text search.

Return value

Type: System.Int32 [.NET] | int32 [C++]

The length of the matching text string, or zero if no matching string is found.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Text
Windows::UI::Text [C++]

Metadata

Windows.winmd

See also

ITextRange

 

 

Show:
© 2014 Microsoft