Regex.Replace and Switch Statement???
Posted on 2006-05-12
I'm using the following code to Regex.Replace all Alpha characters from a very long alphanumeric string with a zero.
string pattern = @"[^\d+]"; //"[A-Za-z:-]";
return Regex.Replace(input, pattern, "0");
Q. Is there a method of replacing each alpha character with a different substitute?
For example: A or a = 1, B or b = 2, : = 0, etc............
I'm thinking about a C# swich statement, however I thought the EE might know a nice Regex.Replace trick. :-)