string-building

Building a directory string from component parts in C#

If i have lots of directory names either as literal strings or contained in variables, what is the easiest way of combining these to make a complete path? I know of Path.Combine but this only takes 2 string parameters, i need a solution that can take any number number of directory parameters. e.g: string folder1 = "foo"; string folde...

Building a Query From a List of Strings

How would you take an arbitrary list of strings (of the form "%[text]%") and a database column, and turn them into a SQL query that does a LIKE comparison for each string in the list? An example: I have three strings in my list, "%bc%", "%def%" and "%ab%". This builds the query: ([ColumnName] LIKE "%bc" AND [ColumnName] LIKE "%def%") A...

Building an Evironment Variable with SET using a FOR loop in Command Prompt

Hi, I am having trouble with the following command prompt commands (in Windows XP). set SOMEVAR= for /F %i in (1 2 3) do set SOMEVAR=%SOMEVAR% "%i" echo %SOMEVAR% I expect it to build the SOMEVAR variable so that it contains each item in the for loop in quotes, separated by a space:  1 2 3 However what this is what I get...