EditPoint2.GetLines(Int32, Int32) 方法

定义

返回表示两个给定行之间的文本的字符串。

public:
 System::String ^ GetLines(int Start, int ExclusiveEnd);
public:
 Platform::String ^ GetLines(int Start, int ExclusiveEnd);
std::wstring GetLines(int Start, int ExclusiveEnd);
[System.Runtime.InteropServices.DispId(173)]
public string GetLines (int Start, int ExclusiveEnd);
[<System.Runtime.InteropServices.DispId(173)>]
abstract member GetLines : int * int -> string
Public Function GetLines (Start As Integer, ExclusiveEnd As Integer) As String

参数

Start
Int32

可选。 最后一个要包含其文本的行的行号。

ExclusiveEnd
Int32

必需。 第一个要包含其文本的行的行号。

返回

String

两个给定行之间的文本。

实现

属性

示例

Sub GetLinesExample()  
   Dim objTextDoc As TextDocument  
   Dim objEditPt As EditPoint, iCtr As Integer  

   ' Create a new text file.  
   DTE.ItemOperations.NewFile("General\Text File")  

   ' Get a handle to the new document and create an EditPoint.  
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")  
   objEditPt = objTextDoc.StartPoint.CreateEditPoint  

   ' Insert ten lines of text.  
   For iCtr = 1 To 10  
      objeditpt.Insert("This is a test." & Chr(13))  
   Next iCtr  
   objEditPt.StartOfDocument()  
   msgbox("The results of GetLines: " & Chr(13) & objeditpt.GetLines(1, 6))  
End Sub  

注解

返回的字符串表示 Start (包含) 和 ExclusiveEnd (独占) 之间的文本。 对于行边界,字符串包含换行符 (ACSII 字符 13) ,如果最后一行以换行符结束,则以换行符结尾。

适用于