[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

removing double quotes from a CString

Posted on 1998-12-28
6
Medium Priority
?
1,594 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:Gareon
ID: 1181176
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
ID: 1181177
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
ID: 1181178
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:jkr
ID: 1181179
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
ID: 1181180
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 100 total points
ID: 1181181
I'm guessing this will do the trick

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

Cheers Greg
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

656 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