C#C
C#4y ago
sonodan.

Searching a string for a substring containing operators

I'm trying to find how many times the string "*" occurs in a string I have.

I've tried a few different things including backslashes, but I found a stackoverflow solution saying a string literal should work:

var matches = response.Where(s => s.Contains(@""*"")).Count;

I'm met with an error Operator * cannot be applied to operands of type 'string' and 'string'. What's the best practice here to accomplish this?
Was this page helpful?