Solved

Quotes in a string

Posted on 2009-05-08
2
372 Views
Last Modified: 2013-12-17
When a printer name is passed to Adobe it needs to quotes around it if the string contains blanks.  This two line program shows that in order to get the desired quote mystery slashs are inserted.  I have tried similar things with char[] with no better results.
char ch = '"';

string test = ch + "my string" + ch;
 

Expected result is "my string", actual result is "\my string\".

Open in new window

0
Comment
Question by:wilfordrocks
2 Comments
 
LVL 7

Accepted Solution

by:
alexpercsi earned 500 total points
Comment Utility
This is strange.

Generally when I need to insert quotes in a string I just prefix them with the \ character which is the escape operator. It does not show up in the final string.
Try this and tell me how it works out.
string test = "\"my string\"";

Open in new window

0
 
LVL 37

Expert Comment

by:gregoryyoung
Comment Utility
let me guess ... you determined that it was \"mystring\" by using the debugger? most likely putting your mouse over the variable?

The debugger shows you strings in escaped format...


Greg
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now