public int IndexOf(String2 source, int index) { if (source.Length < 1) { return(-1); } if (Length < source.Length + index) { return(-1); } for (int i = index; i <= Length - source.Length; i++) { if (String2.CheckByte(data, i, source.ToBytes(), 0, source.Length)) { return(i); } } return(-1); }
public int IndexLastOf(String2 source) { if (source.Length < 1) { return(-1); } if (Length < source.Length) { return(-1); } for (int i = Length - source.Length - 1; i >= 0; i--) { if (String2.CheckByte(data, i, source.ToBytes(), 0, source.Length)) { return(i); } } return(-1); }
public String2 ReadFile(String filepath) { FileInfo info = new FileInfo(filepath); if (!info.Exists) { throw new Exception("not file"); } if (".JS".Equals(info.Extension.ToUpper())) { ContextType = "text/javascript; charset=UTF-8"; } if (".CSS".Equals(info.Extension.ToUpper())) { ContextType = "text/css; charset=UTF-8"; } using (FileStream stream = new FileStream(info.FullName, FileMode.Open, FileAccess.Read)) { _body = new String2((int)info.Length); stream.Read(_body.ToBytes(), 0, (int)info.Length); } StateOK(); return(_body); }
public bool CheckEnd(String2 separator) { return(CheckEnd(separator.ToBytes())); }