Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I am having a string and I want to append some string in it on some condition.

For example-

CString str= "12 V High Battery Voltage Threshold";

I want to append "\ at the index 0 and append \" at the last index of the string

so that my string will look like this.

CString strFinalString= "\"12 V High Battery Voltage Threshold\"";

this has to be done dynamically.

I am able to append \" in the string using

str.Append(_T("\""));

but how to insert the string "\ at the 0 index.?
Posted

1 solution

CString provides the concatenation operator (+)
C++
str = "\"" + str + "\"";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900