Fixed lenght of bytes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brpe
    New Member
    • Apr 2009
    • 3

    Fixed lenght of bytes

    Hi all

    Newbie... trying to convert phonenumber to a fixed lenght of bytes.

    Example: 30172985 phonenumber is 8 byte. But my hardware wants 32 byte size.

    How do I automaticly insert 0x00 from 8 byte and upwards to 32?

    My hardware expects to see this:

    333031373239383 500000000000000 000000000000000 000000000000000 0000

    Phonenumber is off course not a fixed value :-)
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Personal curiousity: What hardware are you dealing with that requires such a goofy thing for a phone number?

    Code:
    NewPhoneNumber = OldPhoneNumber + "0000000000000000000000000000000".Substring(OldPhoneNumber.Length);
    Just take the short phonenumber (oldphonenumber ) and add to it the right number of zeros, would would be a 32 zero string, less the length of the current phone number. If you have a 10 digit, you add 22 zeros. If you have a 12 digit you add 10. Etc. All automatically calculated from the length of the oldphonenumber.

    Comment

    • brpe
      New Member
      • Apr 2009
      • 3

      #3
      Thx

      Thank you very much!

      Remoting a Prodys Prontonet :-)

      Comment

      Working...