Gareon
asked on
removing double quotes from a CString
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.
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
// 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
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
If it works good, if not :-| (Maybe give some code where you try to find the string or somethin)
-Viktor
--Ivanov
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...)
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...)
Gareon, it seems the common theme here is "it should work". Would you please post the source code so we can make it work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
" ,.;:[]{}()*&%#@!~`'?\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.