CString s="A"; long i=2; HOW to add i to s to get "A2" in other CString ?

All is in title :)
Please simple solution ever NOT so fast.

I seek 30 minutes and CAN not find how to do it :)
In VB 6 I just will write
NewString = s & i
dvplayltdAsked:
Who is Participating?
 
AxterConnect With a Mentor Commented:
Using the CString::Format method, you can easily put different types together.
In the code below, %s represents a string, and %i represents a number.

CString s = "A";
long i = 2;
CString NewString;
NewString.Format("%s%i", s, i);

You can also use itoa to convert a number to a string, but the above CString::Format method is better in general
0
 
dvplayltdAuthor Commented:
Come on, it i easy ! The fastest expert will win !
0
 
AxterCommented:
Example code:

NewString.Format("%s%i", s, i);
0
All Courses

From novice to tech pro — start learning today.