-5

how to split a string that contains comma and store into 3 variables.

i have a string like this

string s= "abcdf5==,ftyuyt6g8*,yut5431";

now i want to split that by comma and store into 3 string variables.
new to C# (rookie)

Deepak Jain
  • 1
  • 1
  • 3
  • 21
  • 1
    You should have google before posting it here. [How do I split a string](https://stackoverflow.com/a/32430150/3796048) – Mohit S Aug 09 '18 at 03:28

1 Answers1

3
string s= "abcdf5==,ftyuyt6g8*,yut5431";

When you get it to compile, you could always use string.Split

var result = s.Split(',');

var variable1 = result[0];
var variable2 = result[1];
var variable3 = result[2];

String.Split Method

Returns a string array that contains the substrings in this instance that are delimited by elements of a specified string or Unicode character array.

TheGeneral
  • 75,627
  • 8
  • 79
  • 119