Solved

removing double quotes from a CString

Posted on 1998-12-28
6
1,449 Views
Last Modified: 2008-01-16
Does anyone know how to add a double quotation mark to a CString literal. I have tried \" and it seems not to work for some reason.
0
Comment
Question by:Gareon
6 Comments
 

Author Comment

by:Gareon
Comment Utility
I am using a CString containing special characters which I want to remove from CStrings in order to separate out only the words. The CString looks like this:
" ,.;:[]{}()*&%#@!~`'?\n\""

When I check against each char in the CString, the program removes everything but the double quotes, which it insists on tacking onto words.

0
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
CString str = "\"" ;

// str will contain a single character (the double quote)

I would suggest you find double quotes using the Find member function of CString

int nIndex = str.Find( '"' ) ; // single quote, double quote, single quote

My guess is you are confusing the single and double quoting mechanism.  Single quotes are used for char variables, double quotes for strings.

Your question is not clear, perhaps you want to explain more or post some code

0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Just a guess.... When searching the CString for the double quote search for \" and not for "

If it works good, if not :-| (Maybe give some code where you try to find the string or somethin)

-Viktor
--Ivanov
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 86

Expert Comment

by:jkr
Comment Utility
This is strange
CString str ( _T("text"));

str = CString(_T("\"")) + CString(_T("quoted "))+ str + CString(_T("\""));

should result in "quoted text", and str.Find( "\"") or str.Find( '\"') should both work... (and even the constructors shouldn't be necessary...)
0
 

Expert Comment

by:nbell
Comment Utility
Gareon, it seems the common theme here is "it should work". Would you please post the source code so we can make it work.
0
 
LVL 3

Accepted Solution

by:
GGRUNDY earned 50 total points
Comment Utility
I'm guessing this will do the trick

" ,.;:[]{}()*&%#@!~`'?\n\"\x93\x94"

Cheers Greg
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

762 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

10 Experts available now in Live!

Get 1:1 Help Now