I have a int number = 1782901998
whose Length is 10 numbers; I need to split them into 10 different strings. I tried the following code, but it does not give back a
Because your code fills the array with the ASCII code for the characters of the number
variable. You can use LINQ like below:
int[] digits = number.Select(c => Convert.ToInt32(c.ToString())).ToArray();
Or if you want to assign the each number to a string simply:
string[] digits = number.Select(c => c.ToString()).ToArray();