How to extract first middle last and name from a full name in C#

1 Answer

0 votes
using System;
  
class Program
{
    static void Main() {
        string name = "James John William";
  
        var arr = name.Split(' ');
  
        Console.WriteLine(arr[0]);
        Console.WriteLine(arr[1]);
        Console.WriteLine(arr[2]);
    }
}
  
  
  
/*
run:
     
James
John
William
     
*/

 



answered Nov 24, 2021 by avibootz

Related questions

1 answer 233 views
1 answer 180 views
1 answer 171 views
1 answer 152 views
1 answer 170 views
...