I have an app running which looks at items in a queue, then based upon certain keywords a category is applied - then it is inserted into a database.
I'm using IndexOf to determine if a certain keyword is present.
Is this the ideal way or would a RegEX be faster?
There's about 10 items per second being processed or so.
For just finding a keyword the IndexOf
method is faster than using a regular expression. Regular expressions are powerful, but their power lies in flexibility, not raw speed. They don't beat string methods at simple string operations.
Anyway, if the strings are not huge, it shouldn't really matter as you are not doing it so often.