Convert string to bytes...

JackOfPH
JackOfPH used Ask the Experts™
on
Does anyone knows how to convert the below string to array of bytes?
AQAAABQAAABEAgAAAQASAAMANAAAAAAAPAIAAMI6AbDe86IpAXHFaIQDIgSCu9cOv3eKKx/7HYZKrLcnKWlLzaB/laobaIExHpTNJCvhNDt6LiBprCkOmD8pzJ3u3GD1sDjGQDIQwHUJLHIkiM6m0dgz/nInajSChn7gPdV3Yl*hRp2kF6hLvVEJhwxNrzn6HVi*Z2CfoavuG1TFZz8shfsskt2T2f6wTia/x*HSn7W75ES0c/OCkwSR0MayAgBEn5SEotWItkKP8e8RReJ4C*lei0yW4iPZ2IgWWEkJQskS4NxozpEZE8WQROe8x68TqaIZr/p7I8WI0qKJflXv8IVKcB0qgVjJNtXBVbQhJzUQ78JoLZNbJxm2Zl45gzbq5FHrJtu0826RqMgT0q3y3xDFUNHIgolp9esGXyc3v9RRO1Yvm4wN4M2ob1T6bs9DXyVKu6Mwf5K6EJwATXgxLKVXGGnv4WmjQ4eIcVcPtkp3XJR*jftErRQXQMBNqSZLH80cclzD3nUqehhUu3NF70sn85rbjCJkJtAlNsFyVNUrJdi72Ax9iOSm9dTguKxSEXZTao8vZHuMfOyaTi8olgha1bj2MyX5CC0Na0G1CUkGfBjb4oYSNKSaLJXRzrp7xFQ5dM*Ymxv6Tnz7u/KbVckttJ8krs/D/PfXD*D1uYmc6aQMC4i5qXj5JH*dFJfDPn/vlIQacBAje6WY3cnB5tkhHpwvp4Hm0RnXcaYiLzZJ*gRqUXEzAg*w*FeWabUWGKutsiCHQrOXzCi*S*VCgAO8/OmWxluoKypp2Q

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

public static byte[] StrToByteArray(string str)
{
    System.Text.ASCIIEncoding  encoding=new System.Text.ASCIIEncoding();
    return encoding.GetBytes(str);
}

Open in new window

hi,

I worked  this with delphi 2009. The function i used is as below :

  Function StrAllToArrByte (strAll : string): TBytes;stdcall;
  var
    i : Integer;
  begin
    SetLength(Result,length(strAll));
    for I := 0 to length(strAll)-1 do
    begin
      Result[i]:= Ord(strAll[i+1]);
    end;
  end;

It returns a array of bytes which can be further used in which ever way required.Hope this function helps your to get your problem solved.
 
Commented:
Hello JackOfPH,

Looks like base64 encoded data. Try this:
Convert.FromBase64String(sYourStringGoesHere)

VB.Net: Base64 Encoding and Decoding in One Line of Code
http://www.nonhostile.com/page-vb-net-base64-encoding-decoding.asp


Regards,

Rimvis

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial