public string GetSubstringFrom(SubstringLocation location) { var startIndex = location.StartIndex; var length = location.EndIndex - location.StartIndex + 1; return(this.SourceText.Substring(startIndex, length)); }
public EffectManager Apply(Effect effect, int startIndex, int endIndex) { var location = new SubstringLocation(startIndex, endIndex); var change = new TextChange(effect, location); this.Changes.Add(change); return(this); }
public EffectManager Apply(Effect effect) { var location = new SubstringLocation(0, this.SourceText.Length - 1); var change = new TextChange(effect, location); this.Changes.Add(change); return(this); }
public string GetSubstringAfter(SubstringLocation location) { var startIndex = location.EndIndex + 1; if (startIndex >= this.SourceText.Length) { return(string.Empty); } return(this.SourceText.Substring(startIndex)); }
public string GetSubstringBefore(SubstringLocation location) { const int startIndex = 0; if (startIndex >= location.StartIndex) { return(string.Empty); } var endIndex = location.StartIndex - 1; var length = endIndex - startIndex + 1; return(this.SourceText.Substring(startIndex, length)); }