The most direct way would be to use a regular expression. (In the
System.Text.RegularExpressions namespace.)
If you use this pattern for a regular expression:
(?<=").+(?=")|[^\s"]+
You will get the following matches on your text:
Hi
There
How
Are you?
In plain English, the pattern reads as "one or more characters preceeded by
a quotation mark and followed by a quotation mark, OR one or more of any
character except for a whitespace character or quotation mark." It's not
very intuitive, but it works.
"Michel Racicot" <mi*********************@cgi.com> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl...
How can I parse easily the following line:
Hi There How "Are you?"
I need to obtain the following values:
1- Hi
2- There
3- How
4- Are You?
Can I use some string tokenisation with this? Can I use the String.Split
member function? How will I treat the "" ?
Thank you