Break String Up Into It’s Words With C#

Disclaimer: I’m new C#, so I’m blogging as I learn. So if you see something I’m missing or a different way of getting the same thing done, leave a comment below and I’ll update the post.

In looking for a way to break a multi-word string into its component string so I could fill in some textboxes on a gui Windows app. I came across this way of accomplishing it.

String input = “This sentence says it all”;

String[] output = input.Split(‘ ‘);

textBox6.Text = output[0];
textBox7.Text = output[1];
textBox8.Text = output[2];

This was derived from How to find the second word in a string on StackOverflow.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s