Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In c#, there is an integer, such as 1234. How to split and save in an array? c[ 1]= 12,c[2]=34
In c#, there is an integer, such as 1234. How to split and save in an array? c[ 1]= 12,c[2]=34
You have created a new console application.

Use the system;

Use the system. Assemble. Generics;

Use the system. Linq

Use the system. Text;

Use the system. Collection;

Namespace Console Application 2

{

Class plan

{

Static void Main(string[] args)

{

int a = 123 14 14;

int count = a.ToString()。 Length% 2 == 0? a.ToString()。 Length/2: a.ToString (). Length/2+1;

ArrayList array = new ArrayList(count);

for(int I = 0; I < count; i++)

{

If (me! = Count-1)

{

int x = I * 2;

int y = I * 2+2;

Array. Add (a.ToString (). Substring(i * 2,2));

}

Otherwise {

Array. Add (a.ToString (). Substring(i * 2, 1));

}

}

}

}

}

Please adopt