Split a name

I have a name: lets say
Johan Andersen

I want to split this into first name and second name.
How do I do it?

I guess I have to search for the space.....but how?
Who is Participating?
crazymanConnect With a Mentor Commented:
string [] nameParts = "Johan Andersen".Split(' ');

string first = nameParts[0];
string second= nameParts[1];
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.