SmackDat SmackDat - 4 months ago 26
C# Question

How to Create a string array by spliting a string?

I am kinda stuck at the moment, i have a string of numbers which i dynamically get them from database, the range of numbers can be between 1 to 1 milion, something like this :

string str = "10000,68866225,77885525,3,787";

i need to create an array from it, i have tried this:

string[] strArr = { str.Replace(",", "").Split(',') };

but it doesnt work anyone has any solution i am all ours. Basically it needs to be like this:

string[] strArr = { "10000","68866225","77885525","3","787" };


Try this:

string[] strArr = str.Split(',');