Re: convert char to byte representation

2005-10-10 Thread Mike Meyer
[Format recovered from top posting.] Larry Bates <[EMAIL PROTECTED]> writes: > Grant Edwards wrote: >> On 2005-10-10, Larry Bates <[EMAIL PROTECTED]> wrote: I am trying to xor the byte representation of every char in a string with its predecessor. But I don't know how to convert a char int

Re: convert char to byte representation

2005-10-10 Thread Larry Bates
I've always read it written that the number that is returned by ord(c) is the "decimal" (not hex, not octal) representation of the ASCII/UNICODE character that is stored in memory location pointed to by variable c. While the result is an integer (as it couldn't really be anything else), I believe

Re: convert char to byte representation

2005-10-10 Thread Peter Otten
Scott David Daniels wrote: > Philipp H. Mohr wrote: >> I am trying to xor the byte representation of every char in a string with >> its predecessor. But I don't know how to convert a char into its byte >> representation. > ord('a') == 97; chr(97) == 'a'; "ord" gives you the value of the byte. > >

Re: convert char to byte representation

2005-10-10 Thread Rick Wotnaz
Scott David Daniels <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Philipp H. Mohr wrote: >> I am trying to xor the byte representation of every char in a >> string with its predecessor. But I don't know how to convert a >> char into its byte representation. > ord('a') == 97; chr(97) ==

Re: convert char to byte representation

2005-10-10 Thread Grant Edwards
On 2005-10-10, Larry Bates <[EMAIL PROTECTED]> wrote: >> I am trying to xor the byte representation of every char in a string with >> its predecessor. But I don't know how to convert a char into its byte >> representation. This is to calculate the nmea checksum for gps data. > ord(c) gives you de

Re: convert char to byte representation

2005-10-10 Thread Scott David Daniels
Philipp H. Mohr wrote: > I am trying to xor the byte representation of every char in a string with > its predecessor. But I don't know how to convert a char into its byte > representation. ord('a') == 97; chr(97) == 'a'; "ord" gives you the value of the byte. > e.g. everything between $ and * nee

Re: convert char to byte representation

2005-10-10 Thread Larry Bates
ord(c) gives you decimal representation of a character. -Larry Bates Philipp H. Mohr wrote: > Hello, > > I am trying to xor the byte representation of every char in a string with > its predecessor. But I don't know how to convert a char into its byte > representation. This is to calculate the nm

convert char to byte representation

2005-10-10 Thread Philipp H. Mohr
Hello, I am trying to xor the byte representation of every char in a string with its predecessor. But I don't know how to convert a char into its byte representation. This is to calculate the nmea checksum for gps data. e.g. everything between $ and * needs to be xor: $GPGSV,3,1,10,06,79,