G
Guest
I have a piece of code where a need to look for specific patterns in a
string. Because there are over 20 patterns I want to place these in a string
array for quick access
if(myValue.IndexOf(myArray)!=-1)
{
//Replace this pattern with a value from another array
}
I tried doing this in a 2 dim array, where one dimension was the pattern and
the other was the replace value. But using FOREACH(string s in myArray) I
couldn’t get it to iterate though the collection.
However I see indexof only accept char arrays. How can I better accomplish
this without a ton of IF statements
string. Because there are over 20 patterns I want to place these in a string
array for quick access
if(myValue.IndexOf(myArray)!=-1)
{
//Replace this pattern with a value from another array
}
I tried doing this in a 2 dim array, where one dimension was the pattern and
the other was the replace value. But using FOREACH(string s in myArray) I
couldn’t get it to iterate though the collection.
However I see indexof only accept char arrays. How can I better accomplish
this without a ton of IF statements