469,963 Members | 2,006 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

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 2130
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
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.