-1

So I made a simple c# file reader because I was bored and added an if statement to filter the results. But when I ran it, it gave me more results than I wanted. I was supposed to get 276, 2, and there was only one line inside the file with that value, but I got multiple. I checked the file and it had lines ending with the same value. I tried string.Equals(line, "276, 2") but it gave me the same results. I doubt there isn't something in c# that doesn't solve this issue.

Daedalus
  • 1
  • 4

1 Answers1

-1

You can use Regex, as it's mentioned in this issue

bool result = Regex.IsMatch(line, "\\b276, 2\\b");
fmansour
  • 555
  • 3
  • 17