/ Published in: C#
Expand |
Embed | Plain Text
private string GetValueBetweenTwoValues(string str, string startVar, string endVar) { string output = String.Empty; Match match = Regex.Match(str, String.Format("{0}(.*){1}", startVar, endVar)); if (match.Success) output = match.Groups[1].Value; return output; } private string GetValue(string text, string startVal, string endVal) { string output = String.Empty; int length = text.Length; int start = text.IndexOf(startVal); if (start > -1) { int end = text.IndexOf(endVal, start); if (end > -1) { int contentLength = (end - start); output = text.Substring(start + (startVal.Length), contentLength - (startVal.Length)); } } return output; }
You need to login to post a comment.
