Basically im using switch case to set strOutput. But i get duplicate values instead..

strInput="00\~01\02~"

This is what i get:
A
AB
ABC

My desired outcome is:
A
B
C

 MatchCollection matches = Regex.Matches(strInput, @"\d{2}\\");
                                                string range = matches[0].Value;

                                                switch (range)
                                                {
                                                    case "00\\":
                                                        strOutput += "A";
                                                        break;
                                                    case "01\\":
                                                        strOutput += "B";
                                                        break;
                                                    case "02\\":
                                                        strOutput += "C";
                                                        break;

                                                }
                                                #endregion
                                                write.WriteLine(strOutput);

I don't see how you get anything other than 'A', there is no loop and you only look at the first match.

My bad. I should have posted my full codes.
strInput= 00\,one,two~01\,one,two~02\,one,two~

string[] line = strInput.Split('~');
foreach (string part in line)
 {

 string[] strInput = part.Split(',');

MatchCollection matches = Regex.Matches(strFields[0], @"\d{2}\\");

string range = matches[0].Value;
switch (range)
 {
  case "00\\":
  strOutput += "A";
  break;

  case "01\\":
  strOutPut += "B";
  break;

  case "02\\":
  strOutput += "C";
  break;

 }

 write.WriteLine(strOutput);

                                            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.