0

I don't seem to find an answer for this in C#, so here it goes:

I have a string:

string slug = "123,456";

And I want to end up with two strings that I can then parse to integers:

Number1 = "123";
Number2 = "456";
zetar
  • 1,195
  • 2
  • 17
  • 42

2 Answers2

3
var numbers = slug.Split(",");
var Number1 = int.Parse(numbers[0])
var Number2 = int.Parse(numbers[1])
Frank Bryce
  • 7,488
  • 4
  • 34
  • 53
1

You can use Split

string[] numbers = slug.Split(",");

matthew_b
  • 653
  • 1
  • 7
  • 17