Thursday 15 September 2011

c# - Get lower nibble of a byte and replace Hex value -


I need to replace the hex value 0xA with 0 and only the lower flop of hex value is found.

Enter image details here

This is the moment I have : Private Zero ParscontextID (Inteced IDE 300, InteciCDI10, IntecTiDII)) {// (A = 0) string hunders = contact IDID 0000. Toaster ("x") 0xA, '0'); String Dozens = ContactID_10.ToString ("X"). Change ((four) 0xA, '0'); String Singles = Contact ID_1. ToString ("X"). Change ((four) 0xA, '0'); Int Hinder Liver = StringTox (Hands) & amp; 0x0F; Int'Dozenslawar = Stringhothex (dozen) & amp; 0x0F; Int Singles Lower = Stringshothex (single) & amp; 0x0F; }

Do I & amp; To get less beak or 0xF0 with 0x0F?
And what is the way to change it before changing 0xA to a string?

I do not think the code you have is what you think it does - (char) 0xA is a line feed, not a letter 'A', so it will not change anything (since toasting ("X") does not generate a line feed As you suspect that string conversion can be completely removed.

To get less hump, you will need to with more than 0x0F . Till < Conversion of code> 0xA to 0 is a few options, but if you can ensure that only the value in the lower position is 0x0 - 0xA (0 - 10) ), You can use the modulo operator (% ) if we convert the modulo of 10, 0xA from 0 to 0, while the value 0 - 9 is left unchanged:

  var hundreds = (ContactID_100 and 0x0F)% 10;    

No comments:

Post a Comment