Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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,

Posted

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";

Anybody looking for a graduate programmer (Midlands, England)?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...