I have a string like:
"bottle 750 green"
The string has a variable number of words each time. I need , based on this string to create:
CONTAINS(descr_en,'"*bottle*" and "*750*" and "*green*"')
I will then attach this to a where clause on an sql statement in order to get the desired results.
How can i create the resulting contains clause?
I have tried this:
var str = "mara 750 bottle";
string[] strarr = str.Split(' ');
var result = "";
foreach (var s in strarr)
{
result += "\"*" + s + "*\"" + " AND ";
}
This gives me : "*mara*" AND "*750*" AND "*bottle*" AND which is almost what i need.
The only thing i need from the above is to get rid of the training " AND "...
I prefer a clean solution based on LINQ if possible.