Solved

removing double quotes from a CString

Posted on 1998-12-28
6
1,475 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
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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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 50 total points
ID: 1181181
I'm guessing this will do the trick

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

Cheers Greg
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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