Textencoding,  ascii,  byte[]

And that's as much coding as I do in the pub!

;)

Davy 

"When all you have is a hammer, every problem looks like a nail." I feel much 
the same way about xml

-----Original Message-----
From: "Tom Gao" <[email protected]>
Sender: [email protected]
Date: Tue, 11 Oct 2011 08:09:56 
To: 'ozDotNet'<[email protected]>
Reply-To: ozDotNet <[email protected]>
Subject: RE: ASCII to int

sorry there's no real world scenario for this. I'm trying to replicate some
calculation purely for academic reasons.

 

From: [email protected] [mailto:[email protected]]
On Behalf Of David Kean
Sent: Tuesday, 11 October 2011 7:42 AM
To: ozDotNet
Subject: RE: ASCII to int

 

Can I ask what's the scenario?  

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Tom Gao
Sent: Monday, October 10, 2011 1:36 PM
To: 'ozDotNet'
Subject: RE: ASCII to int

 

Very nice. Thank you

 

Any suggestion on how I can convert it back to string?

 

 

From: [email protected] [mailto:[email protected]]
On Behalf Of David Rhys Jones
Sent: Tuesday, 11 October 2011 1:05 AM
To: ozDotNet
Subject: Re: ASCII to int

 

            int total = 0;
            string str = "abcdefghijklmnopqrstuvwxyz";
            foreach (char c in str.ToCharArray())
            {
                total += (int)c;
            }

            Assert.AreEqual(42, total);




Davy,


"Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live." 

- Martin Golding

"After a bit of digging, it was pretty clear that the 'issues' were in the
data access class. It was named 'summoner.cs'"  DailyWTF

 

On Mon, Oct 10, 2011 at 3:37 PM, Tom Gao <[email protected]> wrote:

Hi All,

 

Does anyone know how to convert a string of ASCII characters to int? 

Eg

"abcd" to some form of int.

 

I need to do a bunch of calculations on strings the only way is if they're
in int not sure if anyone know of a good way to do this.

 

Thanks,

Tom

 


Reply via email to