|
"Brendan Bispham" <midrangel@black-and-blue.com> wrote: >I think base 32 is the best I have come up with, as 26 >alphabetic characters and 10 digits mean that you can >cover 32 different characters? In theory - fine, but in >practise - I'm lost. Brendan, You can convert any 10 digit base 10 number to a valid object name using a maximum of 7 significant characters. An object name has to begin with A-Z, $, # or @. This gives you 29 possibilities for character 1. Subsequent characters can be any of these plus 0-9, _ and . giving you 41 possibilities for each character in positions 2 - 10. So let A through Z represent 0 through 26, $ represent 27, # represent 28, @ represent 29, 0 through 9 represent 30 through 39, _ represent 40 and . represent 41. As an object name is (a maximum of) 10 characters we can represent any number that will convert to base 41 as long as the leading digit does not go above 29. This gives us a highest number of (30(41**9))-1. So a decimal value of 9,999,999,999 would give 2-4-12-35-26-40-0 in base 41. This translates to "BDL5Z_0". Putting in the leading "zeroes" we get an object name of AAABDL5Z_0. Incidentally, Leif's solution of using a 4 byte binary representation not only fails to produce valid object names but can't represent numbers higher than 4,294,967,295. Decimal 9,999,999,999 requires 9 digits in hexadecimal. Dave Kahn, ABB Steward Ltd. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.