Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting a string at all whitespace

Tags:

.net

vb.net

I need to split a string at all whitespace, it should ONLY contain the words themselves.

How can I do this in vb.net?

Tabs, Newlines, etc. must all be split!

This has been bugging me for quite a while now, as my syntax highlighter I made completely ignores the first word in each line except for the very first line.

like image 890
Cyclone Avatar asked Oct 13 '09 21:10

Cyclone


2 Answers

String.Split() (no parameters) does split on all whitespace (including LF/CR)

like image 65
Jimmy Avatar answered Oct 14 '22 12:10

Jimmy


Try this:

Regex.Split("your string here", "\s+")
like image 29
Rubens Farias Avatar answered Oct 14 '22 11:10

Rubens Farias