brownkj
January 1st, 2005, 10:33 PM
I'm getting odd behaviour trying to insert double quotes (") into a string. According to the Help I should be able to either double enter the quotes or use the escape sequence \". Their examples are as follows:
string e = "Joe said \"Hello\" to me"; // Joe said "Hello" to me
string f = @"Joe said ""Hello"" to me"; // Joe said "Hello" to me
Instead, when I execute the following two lines and then report their values in the Command Window - Immediate I get:
string e = "Joe said \"Hello\" to me";
string f = @"Joe said ""Hello"" to me";
?e
"Joe said \"Hello\" to me"
?f
"Joe said \"Hello\" to me"
But it seems to only effect the double quote. If I try the escape for a single quote it works fine:
?"test \' end" //test and end added to make the single quote more clear
"test ' end"
Am I going crazy or is this thing not doing what its supposed to? How do I get a double-quote inserted into my string so I can execute command line apps? What I need to get to is the following to register new DLLs (represented by a FileInfo destinationFile):
System.Diagnostics.Process.Start(Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\system32\regsvr32.exe /s " + destinationFile.FullName);
If the destinationFile.FullName contains spaces, this won't work without double quotes around it.
string e = "Joe said \"Hello\" to me"; // Joe said "Hello" to me
string f = @"Joe said ""Hello"" to me"; // Joe said "Hello" to me
Instead, when I execute the following two lines and then report their values in the Command Window - Immediate I get:
string e = "Joe said \"Hello\" to me";
string f = @"Joe said ""Hello"" to me";
?e
"Joe said \"Hello\" to me"
?f
"Joe said \"Hello\" to me"
But it seems to only effect the double quote. If I try the escape for a single quote it works fine:
?"test \' end" //test and end added to make the single quote more clear
"test ' end"
Am I going crazy or is this thing not doing what its supposed to? How do I get a double-quote inserted into my string so I can execute command line apps? What I need to get to is the following to register new DLLs (represented by a FileInfo destinationFile):
System.Diagnostics.Process.Start(Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\system32\regsvr32.exe /s " + destinationFile.FullName);
If the destinationFile.FullName contains spaces, this won't work without double quotes around it.