I have a list of 400 strings that all end in "_GONOGO" or "_ALLOC". When the application starts up, I need to strip off the "_GONOGO" or "_ALLOC" from every one of these strings.
I tried this: 'string blah = Regex.Replace(string, "(_GONOGO|_ALLOC)", ""));'
but it is MUCH slower than a simple conditional statement like this:
if (string.Contains("_GONOGO"))
// use Substring
else if (string.Contains("_ALLOC"))
// use Substring w/different index
I'm new to regular expressions, so I'm hoping that someone has a better solution or I am doing something horribly wrong. It's not a big deal, but it would be nice to turn this 4 line conditional into one simple regex line.