tphuynh 0 Newbie Poster

Hi ,


What do I need to modify in the "System.Text.RegularExpressions.Regex.Split(contents, "\\s+", RegexOptions.None);" so the string will also keep whitespaces?

For example, in the .dat file you have:

Hello Word Test1 Test2 Test3

If you noticed, I have whitespaces between each words, I want to keep that.

so

string[0] = Hello
string[1] = " "
string[2] = Word
string[3] = " "
string[4] = Test1
string[5] = " "

..
..... and so on. Can this be done?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.