Fast way to make sure string does not contain specific characters

Viewed 1691

I want to make sure that C# string does not contain specific characters.

I am using string.IndexOfAny(char[]), in my opinion Regex would be slower in this task. Is there a better way to accomplish this? Speed is critical in my application.

4 Answers
Related