本文整理汇总了C#中Mono.TextEditor.Document.GetTextBetween方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetTextBetween方法的具体用法?C# Document.GetTextBetween怎么用?C# Document.GetTextBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.TextEditor.Document
的用法示例。
在下文中一共展示了Document.GetTextBetween方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveIndent
static string RemoveIndent (string text, string indent)
{
Document doc = new Document ();
doc.Text = text;
StringBuilder result = new StringBuilder ();
foreach (LineSegment line in doc.Lines) {
string curLineIndent = line.GetIndentation (doc);
int offset = Math.Min (curLineIndent.Length, indent.Length);
result.Append (doc.GetTextBetween (line.Offset + offset, line.EndOffset));
}
return result.ToString ();
}
示例2: RemoveIndent
static string RemoveIndent (string text, string indent)
{
Mono.TextEditor.Document doc = new Mono.TextEditor.Document ();
doc.Text = text;
StringBuilder result = new StringBuilder ();
bool firstLine = true;
foreach (LineSegment line in doc.Lines) {
string curLineIndent = line.GetIndentation (doc);
if (firstLine && curLineIndent.Length == line.EditableLength)
continue;
firstLine = false;
int offset = Math.Min (curLineIndent.Length, indent.Length);
result.Append (doc.GetTextBetween (line.Offset + offset, line.EndOffset));
}
return result.ToString ();
}