472,119 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

How to convert a char[] of integers to a string.

I can convert from a string to a char array (char[]) by using
string.ToCharArray() function. Now how do I convert it back?

The string looks like this: "000457". I've converted it to a char
array: char[] = {0, 0, 0, 4, 5, 7}. Now I need to convert it back to a
string.

Thanks in advance for your help.

Steve

Feb 26 '07 #1
2 2233
It's so simply you're going to want to kick yourself, it's also so simple
that it's going to get overlooked.

string mystring = new string(charArray);

if you look at the overloaded constructor for the string class, you'll
notice that one of the parameters is a char array. This "should" work just
fine though I haven't toyed with it in a long time.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11*********************@h3g2000cwc.googlegrou ps.com...
>I can convert from a string to a char array (char[]) by using
string.ToCharArray() function. Now how do I convert it back?

The string looks like this: "000457". I've converted it to a char
array: char[] = {0, 0, 0, 4, 5, 7}. Now I need to convert it back to a
string.

Thanks in advance for your help.

Steve

Feb 26 '07 #2
On Feb 26, 11:47 am, "Mark Fitzpatrick" <markf...@fitzme.comwrote:
It's so simply you're going to want to kick yourself, it's also so simple
that it's going to get overlooked.

string mystring = new string(charArray);

if you look at the overloaded constructor for the string class, you'll
notice that one of the parameters is a char array. This "should" work just
fine though I haven't toyed with it in a long time.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Steve Kershaw" <steve_kers...@yahoo.comwrote in message

news:11*********************@h3g2000cwc.googlegrou ps.com...
I can convert from a string to a char array (char[]) by using
string.ToCharArray() function. Now how do I convert it back?
The string looks like this: "000457". I've converted it to a char
array: char[] = {0, 0, 0, 4, 5, 7}. Now I need to convert it back to a
string.
Thanks in advance for your help.
Steve- Hide quoted text -

- Show quoted text -
You are right! I did kick myself for overlooking the simple solution.
Thanks for your help!!!!

Steve

Feb 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Markus Zeindl | last post: by
7 posts views Thread by Chris Ritchey | last post: by
5 posts views Thread by Sam Smith | last post: by
4 posts views Thread by Vijai Kalyan | last post: by
24 posts views Thread by djozy | last post: by
20 posts views Thread by Niyazi | last post: by
4 posts views Thread by meendar | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.