Ad

How To Split A String Into Numbers?

- 1 answer

How can I split the following string in C#?

11213,334990829,2234,

I want to store each string (comma delimited) in a variable: e.g.

Number1 = 11213
Number2 = 334990829
Number3 = 2234

Also, a max of 4 numeric strings would be present and if the string has less than 4 numeric strings than there will be a "," at the end of the string

For e.g: if there were two numeric strings, it would display 12121,43222,

Ad

Answer

String[] numbers = "11213,334990829,2234,".Split(',');
Ad
source: stackoverflow.com
Ad