问题描述
我有一个字符串,我想在某些条件下附加一些字符串。
例如 -
CString str =12 V高电池电压阈值;
我想在索引 0 追加\ 并在最后索引追加 \字符串
所以我的字符串看起来像这样。
CString strFinalString = \12 V高电池电压阈值\;
这必须动态完成。
我可以在字符串中附加 \使用
str.Append(_T( \));
但是如何在0 index.?
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.?
推荐答案
str = "\"" + str + "\"";
这篇关于如何在指定位置的字符串中附加字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!