Concatenate char to String

G

Guest

Okay I know this is basic C++ but can someone tell me how to concatenate
char[] to string.
Ex:
char hexChar[]={'A','B','C','D','E','F'};
String *str ="A";

how can I do this:
str = hexChar[1] + hexChar[3]; or str = str + hexChar[3];

thanx,
Poe
 
T

Tomas Restrepo \(MVP\)

Okay I know this is basic C++ but can someone tell me how to concatenate
char[] to string.
Ex:
char hexChar[]={'A','B','C','D','E','F'};
String *str ="A";

how can I do this:
str = hexChar[1] + hexChar[3]; or str = str + hexChar[3];

If you're refering to System::String here, then the appropriate way would be
to use String::Concat(). You might want to make hexChar an array of
System::Char or wchar_t, instead, though...
 
G

Guest

Thank you will do.

Tomas Restrepo (MVP) said:
Okay I know this is basic C++ but can someone tell me how to concatenate
char[] to string.
Ex:
char hexChar[]={'A','B','C','D','E','F'};
String *str ="A";

how can I do this:
str = hexChar[1] + hexChar[3]; or str = str + hexChar[3];

If you're refering to System::String here, then the appropriate way would be
to use String::Concat(). You might want to make hexChar an array of
System::Char or wchar_t, instead, though...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top