public IEnumerable <FindResult> EnumFind(string[] CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck(), IList <IResultSkippingHandler> Handlers = null) { if (!CanContain(CmpWith, Back)) { yield break; } var RSM = new ResultSkippingManager(Handlers, this, Back); while (RSM.Loop()) { var Res = SubstringEquals(RSM.Current, CmpWith, Skip, Back, IdCharCheck); if (Res.Position != -1) { yield return(Res); if (Back) { RSM.Current -= Res.String.Length - 1; } else { RSM.Current += Res.String.Length - 1; } } } }
public int SubstringEquals(int Index, string CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck()) { var RIndex = Index; if (Back) { RIndex -= CmpWith.Length - 1; } if (SubstringEqualsS(RIndex, CmpWith, IdCharCheck)) { if (Skip != null) { for (var i = 0; i < Skip.Length; i++) { var SkipStr = Skip[i]; if (SkipStr.Length >= CmpWith.Length) { for (var SkipPos = -SkipStr.Length + 1; SkipPos < CmpWith.Length; SkipPos++) { if (SubstringEqualsS(RIndex + SkipPos, SkipStr)) { return(-1); } } } } } return(RIndex); } return(-1); }
public IEnumerable <int> EnumFind(string CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck(), IList <IResultSkippingHandler> Handlers = null) { var RSM = new ResultSkippingManager(Handlers, this, Back); while (RSM.Loop()) { var Res = SubstringEquals(RSM.Current, CmpWith, Skip, Back, IdCharCheck); if (Res != -1) { yield return(Res); } } }
public FindResult SubstringEquals(int Index, string[] CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck()) { for (var i = 0; i < CmpWith.Length; i++) { var e = CmpWith[i]; var Res = SubstringEquals(Index, e, Skip, Back, IdCharCheck); if (Res != -1) { return(new FindResult(i, Res, e)); } } return(new FindResult(-1, -1, null)); }
public FindResult Find(string[] CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck(), IList <IResultSkippingHandler> Handlers = null) { if (!CanContain(CmpWith, Back)) { return(new FindResult(-1, -1, null)); } var RSM = new ResultSkippingManager(Handlers, this, Back); while (RSM.Loop()) { var Res = SubstringEquals(RSM.Current, CmpWith, Skip, Back, IdCharCheck); if (Res.Position != -1) { return(Res); } } return(new FindResult(-1, -1, null)); }
public int Find(string CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck(), IList <IResultSkippingHandler> Handlers = null) { return(String.Find(CmpWith, Skip, Back, IdCharCheck, Handlers)); }
public IEnumerable <FindResult> EnumFind(string[] CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck(), IList <IResultSkippingHandler> Handlers = null) { return(String.EnumFind(CmpWith, Skip, Back, IdCharCheck, Handlers)); }
public FindResult EndsWith(string[] CmpWith, string[] Skip = null, IdCharCheck IdCharCheck = new IdCharCheck()) { return(String.EndsWith(CmpWith, Skip, IdCharCheck)); }
public FindResult SubstringEquals(int Index, string[] CmpWith, string[] Skip = null, bool Back = false, IdCharCheck IdCharCheck = new IdCharCheck()) { return(String.SubstringEquals(Index, CmpWith, Skip, Back, IdCharCheck)); }
public bool EndsWith(string CmpWith, IdCharCheck IdCharCheck = new IdCharCheck()) { return(String.EndsWith(CmpWith, IdCharCheck)); }
public bool SubstringEqualsS(int Index, string CmpWith, IdCharCheck IdCharCheck = new IdCharCheck()) { return(String.SubstringEqualsS(Index, CmpWith, IdCharCheck)); }
public FindResult EndsWith(string[] CmpWith, string[] Skip = null, IdCharCheck IdCharCheck = new IdCharCheck()) { return(SubstringEquals(Length - 1, CmpWith, Skip, true, IdCharCheck)); }
public FindResult StartsWith(string[] CmpWith, string[] Skip = null, IdCharCheck IdCharCheck = new IdCharCheck()) { return(SubstringEquals(0, CmpWith, Skip, false, IdCharCheck)); }
public bool EndsWith(string CmpWith, IdCharCheck IdCharCheck = new IdCharCheck()) { return(SubstringEqualsS(Length - CmpWith.Length, CmpWith, IdCharCheck)); }
public bool StartsWith(string CmpWith, IdCharCheck IdCharCheck = new IdCharCheck()) { return(SubstringEqualsS(0, CmpWith, IdCharCheck)); }
public bool SubstringEqualsS(int Index, string CmpWith, IdCharCheck IdCharCheck = new IdCharCheck()) { var CmpLen = CmpWith.Length; if (CmpLen == 1) { if (Index < 0 || Index >= Length) { return(false); } if (String[this.Index + Index] != CmpWith[0]) { return(false); } } else if (CmpLen != 0) { if (Index < 0 || CmpLen + Index > Length) { return(false); } var RIndex = Index + this.Index; for (var i = 0; i < CmpLen; i++) { if (String[RIndex + i] != CmpWith[i]) { return(false); } } } else { return(true); } if (IdCharCheck.CheckIdChars) { var Func = IdCharCheck.IsIdChar; if (Index > 0) { var SelfChar = String[this.Index + Index - 1]; var CmpChar = CmpWith[0]; if ((Func != null ? Func(SelfChar) : Helper.IsIdChar(SelfChar)) && (Func != null ? Func(CmpChar) : Helper.IsIdChar(CmpChar))) { return(false); } } if (Index + CmpLen < Length) { var SelfChar = String[this.Index + Index + CmpLen]; var CmpChar = CmpWith[CmpLen - 1]; if ((Func != null ? Func(SelfChar) : Helper.IsIdChar(SelfChar)) && (Func != null ? Func(CmpChar) : Helper.IsIdChar(CmpChar))) { return(false); } } } return(true); }