Darthlemi
Darthlemi

Reputation: 173

Put Quote Mark in between 2 string objects

I have looked and looked and look for a way to put a " in between 2 string objects. I know you can use "\"" to get a quote or even @"""" for the same result.

string quote = "\"";
string cheatName = "UnlockTankLine(" + nationNum.ToString() + "," + quote + 
                                   nationTankName[1] + quote  + ")";

m_cheater.ActivateCheat(cheatName);

I need a result of "UnlockTankLine(int, "name")"... but when i do the above i get something like "UnlockTankLine(int, \"name\")" and this isn't working with a cmd line for our game.

NOW if i am dumb and \"name\" is the same thing as "name" and the problem might be somewhere else. The only reason why I think i am not being dumb is if i use a different cheat cmd that doesn't take a string it works fine. Example UnlockWholeTankLine(int) works

Upvotes: 0

Views: 88

Answers (1)

user3401335
user3401335

Reputation: 2405

try to use format

 string cheatName = string.Format("UnlockTankLine({0},\"{1}\")",
                                  nationNum.ToString(), nationTankName[1])

Upvotes: 2

Related Questions