Glenn Patton

Glenn Patton

  • NA
  • 308
  • 82.8k

.Contains or delimeters

Mar 12 2012 10:18 AM
Hi All,

I am loading in data putting it in a string variable and the going through it with a
            char[] delimetersChars = { '\n', '\r'}; 
and a   string[] Values = FileData.Split(delimetersChars);

The delimetersChars had the < & > chars as I am using those to denote the start & end of messages. In the act of spotting possible errors as the data is not always reliable...

if (!Values[a].Contains('<') || !Values[a].Contains('>'))
                       Values[a] = "";
My thinking was this would check to see if there is an < & > is there an easier (better) way to do this.

Glenn



Answers (21)