How to add a character in the begin and end of the string?
C / C++ / MFC
5
Posts
5
Posters
0
Views
1
Watching
-
in the begin and end of "abc xyz" I want to display "[abc xyz]" help me ...:confused: Thanks in advance Ashok
CString str = _T("abc xyz");
str = _T("[") + str + _T("]");
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
in the begin and end of "abc xyz" I want to display "[abc xyz]" help me ...:confused: Thanks in advance Ashok
ashokbngr wrote:
in the begin and end of "abc xyz" I want to display "[abc xyz]"CString csStr;
csStr.Format( _T( "[%s]" ), _T( "abc xyz" ));
Nibu thomas A Developer Programming tips[^] My site[^]
-
in the begin and end of "abc xyz" I want to display "[abc xyz]" help me ...:confused: Thanks in advance Ashok
You can use the CString.Insert method and the += operator:
CString myString = "abc xyz";
myString.Insert(0, '[');
myString += "]";See MSDN CString.Insert[^] Hope that helps.
Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
-
in the begin and end of "abc xyz" I want to display "[abc xyz]" help me ...:confused: Thanks in advance Ashok
CString s1 = "abc xyz"; CString s2 = "[" + s1 + "]";