1

I'm taking users input from one textbox where multiple choices will be separated by commas, like:

Peter Gabriel, John Snow, Lebron James

I'm separating these strings like

string[] inputAuthors = txtAuthors.Text.Split(',');

now I want from inputAuthors[0] (Peter Gabriel) to select separated Peter and Gabriel. As I see the only way is to split this strings as space as index of separation, but I don't know how to do it.

3
  • 4
    how about another split, similar to the one you already know? Commented Oct 18, 2013 at 11:22
  • yep, but how to use space value? Commented Oct 18, 2013 at 11:23
  • 1
    ' ' or " " <--------------- not rocket science Commented Oct 18, 2013 at 11:23

2 Answers 2

1

Like this?

var namesSeparated = inputAuthors[0].Split(' ');
Sign up to request clarification or add additional context in comments.

Comments

0

Like this:

String[] names;
names = inputAuthors[0].Text.Split(' ');

?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.