I'm stucked to figurer out how can I make a program to change the order of the name in array. It's expect that the program show first the last name and after the first name and the rest of the name must be abreviated.
static void Main(string[] args)
{
string[] names = { "Paul Page Load Wood", "Michael Kraiser Unter", "Mia Rock Spark" };
/*Present the names
names[1] = "Wood, Paul P. l.";
names[2] = "Unter, Michael K.";
names[3] = "Spark, Mia R."*/
}
Can you please help.
Thank you
Here's what I have so far:
static void Main(string[] args)
{
string[] names = { "Paul Page Load Wood", "Michael Kraiser Unter", "Mia Rock Spark" };
int i = 0;
foreach (string name in names)
{
string[] eachName = name.Split(' '); // I was advised to no use .split
for (int j = 0; j < eachName.Length; j++)
{
Console.WriteLine("{0} {1}", j, eachName[j]);
}
i++;
Console.WriteLine();
}
}