0

I want to convert string to string array using "," separator. I'm using this code below but when string has an ampersand cuts the end of string.

string example = "one,two,three&four";
return new []{ example };

// result ["one,two,three"]

How can I get the result: ["one","two","three&four"] ?

kenzolek
  • 344
  • 6
  • 24

1 Answers1

1

You should use Split not Join.

Please try to this:

string[] result = example.Split(',');
Adem Catamak
  • 1,987
  • 2
  • 17
  • 25