Hi there,
I am passing a class of enemy and its sub class to another object as a two digit number. An example would be 32, where 3 is boss, and 2 is boss2. What I want to do is get the separate values, 3 and 2, from 32.
How can I do this?
Hi there,
I am passing a class of enemy and its sub class to another object as a two digit number. An example would be 32, where 3 is boss, and 2 is boss2. What I want to do is get the separate values, 3 and 2, from 32.
How can I do this?
int[] GetIntArray(int num)
{
List<int> listOfInts = new List<int>();
while(num > 0)
{
listOfInts.Add(num % 10);
num = num / 10;
}
listOfInts.Reverse();
return listOfInts.ToArray();
}
Source: http://stackoverflow.com/questions/4808612/how-to-split-a-number-into-individual-digits
Thank you.