String use of Split (separated by a specific character, to extract the required information)

Here to copy a string of numbers separated by spaces, extract the digital sort

int [] = A new new int [10];
String INPUT = Console.ReadLine (); // Get user input string
char [] chs = { '' }; // the partition type - blank
string [] arr = input.Split (chs, StringSplitOptions.RemoveEmptyEntries); // split return is a space-separated string array, StringSplitOptions.RemoveEmptyEntries (here represented by a space removed, leaving only a digital)
for (int I = 0; I < A.length; I ++)
{
A [I] = the int.Parse (ARR [I]);
}
for (int I = 0; I <A.length; I ++)
{
Console.WriteLine ( "{0}", A [I]);
}
the Console.ReadKey ();

 

Here are additional array of type int, the above code is the custom array (dynamic array)

 

Guess you like

Origin www.cnblogs.com/Kai-YoungMaster/p/12375570.html