This is as far as I have got. My thinking was to stuff the string into an array, format it and recast it into a string.
//input search term
Console.WriteLine("What is your search query?:");
string searchTerm = Console.ReadLine();
//stuff the search term into an array to split it out
string separator = " "; //assumes search terms are separated by spaces
string[] searchTermArray = searchTerm.Split(separator.ToCharArray());
//construct the search term
string searchTermFormat = "";
for (int i = 0; i < searchTermArray.Length; i++)
{
searchTermFormat += searchTermArray[i] + "+";
//Console.WriteLine(searchTermFormat);
}
Desired output
word1+word2+word3
where the number of words are not fixed.
String.Join("+", searchTermArray)searchTerm.Replace(' ', '+')Uri.EscapeDataString(searchTerm)