|
TextLine Class |
Top Previous Next |
|
For a list of all members of this type, see TextLineList Members.
Description
Represents a line of found or surrounding text.
Thread Safety
This class is safe for multithreaded read access.
Remarks
Text lines that are found will have one or more matches in the TextMatchList property but text lines that are surrounding lines will not have any matches.
Example
[Visual Basic]
engineSearch = New SearchEngineClass
engineSearch.SearchCriteria.FileName = "*.txt" engineSearch.SearchCriteria.ContainingText = "search" engineSearch.SearchCriteria.LookIn = "c:\search folder"
Dim listResult As SearchResultItemList = engineSearch.Start( False )
' Output the files, with their text lines and hits to the console
Dim buildText As New System.Text.StringBuilder
For nItem As Integer = 0 To (listResult.Count - 1) ' Each item in the list includes information about the found ' item (e.g. its name and path) and also the list of text lines ' found if this was a content search
Dim item As SearchResultItem = listResult(nItem)
buildText.Append(item.Path) buildText.Append(item.FileName) buildText.Append(vbCrLf)
Dim listText As TextLineList = item.TextLineList
For nText As Integer = 0 To (listText.Count - 1) ' Each text line includes the line number and text found and also ' a list showing where the expression matches occurred.
Dim line As TextLine = listText(nText)
Dim listMatch As FLProCoreLib.TextMatchList = line.TextMatchList For nHit As Integer = 0 To (listMatch.Count - 1) buildText.AppendFormat(" {0}:{1} ", listMatch(nHit).Start, listMatch(nHit).Length) Next buildText.Append(vbCrLf) Next Next
System.Console.Write( buildText.ToString() )
|