Shaitan00 Posted December 7, 2005 Posted December 7, 2005 I have the following line of text that I want to store in a STRING oApp -o -E \STORE* "GRAB ALL SELECT*" (where STORE* and SELECT* are actually variables. So this gives me the following (I know it doesn't work but it illustrates my point): string sApp = "oApp -o -E \\" + STORE* + ""GRAB ALL " + SELECT* + ""; Of course that doesn't work at all, it generates a huge list of errors because I am using "s in my string (which is killing everything). So my question, how do I change sApp (string) so that it works? I need to have "s in my string AND I need to be able to add variables (as I did in the example). Any help/hints would be greatly appreciated, Thanks, Quote
Cags Posted December 7, 2005 Posted December 7, 2005 I'm not entirely sure what the line you wanted to create was, but heres how you do it string sName = "Shaitan00"; string sString = @"The man said ""Hello " + sName + @"""" + " this is a quote."; If you want to represent a double quote in a string literal, the escape sequence is two double quotes. Also using @ tells c# to use the literal values for example you could make a path reference as the following without the escape characters for each \. string sPath = @"c:\documents and settings\bob\my documents"; Quote Anybody looking for a graduate programmer (Midlands, England)?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.