does the encodings work?

Jan 29, 2012 at 5:48 AM

Does encoding work, like where I can take a string to bytes, or ASCII, or Hex? Thanks - Matt

Coordinator
Jan 29, 2012 at 3:38 PM
the encoding classes are not working, but you can do:

(byte)"A"[0]

that'll give you 65

On Sun, Jan 29, 2012 at 6:48 AM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

Does encoding work, like where I can take a string to bytes, or ASCII, or Hex? Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Developer
Jan 29, 2012 at 5:46 PM

Just as a note for those who might not understand why the example you gave works, A string has an indexer which returns a 'char' type, and chars can be cast to any physical type, meaning, in this example, the char at index 0 in the string is being cast to a byte, which is what gives you 65.

Jan 29, 2012 at 7:53 PM
mterwoord wrote:
the encoding classes are not working, but you can do:

(byte)"A"[0]

that'll give you 65

On Sun, Jan 29, 2012 at 6:48 AM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

Does encoding work, like where I can take a string to bytes, or ASCII, or Hex? Thanks - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Cool, thanks mterwood, now I can build a convert tobyte function =). Thanks - Matt, And thanks Orvid for explaining how it works.

Jan 29, 2012 at 11:25 PM

This may seem like a stupid thing to say, but why couldn't you just use the character literal (') instead (I mean if you were only looking to convert a single character)?

Jan 29, 2012 at 11:41 PM
lukeTerry wrote:

This may seem like a stupid thing to say, but why couldn't you just use the character literal (') instead (I mean if you were only looking to convert a single character)?

Hmm never thought of that, and I don't think it's stupid. Just another way of doing something, like switch instead of if. Thanks - Matt

Coordinator
Jan 30, 2012 at 8:05 AM
Because the question was about converting string to byte, not char to byte..

On Mon, Jan 30, 2012 at 12:25 AM, lukeTerry <notifications@codeplex.com> wrote:

From: lukeTerry

This may seem like a stupid thing to say, but why couldn't you just use the character literal (') instead (I mean if you were only looking to convert a single character)?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Feb 19, 2012 at 1:50 AM
mterwoord wrote:
Because the question was about converting string to byte, not char to byte..

On Mon, Jan 30, 2012 at 12:25 AM, lukeTerry <notifications@codeplex.com> wrote:

From: lukeTerry

This may seem like a stupid thing to say, but why couldn't you just use the character literal (') instead (I mean if you were only looking to convert a single character)?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Is there anyway to convert decimal to binary? Thanks - Matt