|
-
Sep 28th, 2002, 02:38 AM
#1
Thread Starter
Lively Member
From byte[] to string or char[]?
How can I do to convert a byte[] array into a char[] array or a string avoiding loops for each byte?
Thank you!
-
Sep 28th, 2002, 11:29 AM
#2
Frenzied Member
I'm not sure but try Convert.ToCharArr();
Dont gain the world and lose your soul
-
Sep 29th, 2002, 04:15 AM
#3
Thread Starter
Lively Member
I'm not sure but try Convert.ToCharArr();
Yessss, if that would exist...
But... what's the aim of your replay?
-
Sep 29th, 2002, 04:32 AM
#4
Frenzied Member
Ok bro, I dont know about the char[], but if you want to convert a byte[] to string, you can try this Convert.ToBase64String().
BTW the aim of my reply was to try and help you. Calm down and go have a cup of coffee man.
Dont gain the world and lose your soul
-
Oct 1st, 2002, 12:05 PM
#5
Hyperactive Member
byte conversion
copied from MSDN byte conversion topic:
Code:
ASCIIEncoding AE = new ASCIIEncoding();
byte[] ByteArray = { 69, 110, 99, 111, 100, 105, 110, 103, 32, 83, 116, 114, 105, 110, 103, 46 };
char[] CharArray = AE.GetChars(ByteArray);
for(int x = 0;x <= CharArray.Length - 1; x++)
{
Console.Write(CharArray[x]);
}
-scott
he he he
-
Oct 3rd, 2002, 04:05 PM
#6
Code:
private byte[] StrToBytes(string s)
{
return System.Text.Encoding.ASCII.GetBytes(s);
}
take a look at System.Text.Encoding.ASCII -- if memory serves you can probaby GetChars() too.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|