I am trying to create a function that will split a string into search terms. Using this code will work fine:
string TestString = "This is a test";
string[] Terms;
Terms = TestString.Split(" ");
This will split my string into 4 strings: "This", "is", "a", "test". However I want words that are enclosed in quotes to be treated as one word:
string TestString = "This \"test will\" fail";
string[] Terms;
Terms = TestString.Split(" ");
This will split my string into 4 strings, again: "This", "\"test", "will\"", "fail"
What I want is for it split that last string into only 3 strings: "This", "test will", "fail"
Anyone have any idea on how to do this?