[thelist] 1.1.2 Sorting

Ed McCarroll Ed at ComSimplicity.com
Thu Dec 5 17:52:00 CST 2002


> not only does it ["01.01.03"] look funny when output, it has to be adjusted any
> time a level exceeds the number of elements that padding supports.  for
> example, let's say you decided that you were going to pad with a single zero
> (01.01.03).  you now have a limitation of 99 (100 if it's zero-based) items
> per element (99.99.99).  what happens if you break that (01.100.01)?  well,
> now you've gotta go back through and update all elements in the affected
> position and add a zero to the front of each one.

Yep.  I'd probably hang on to the clean "8.23.456" for display, and generate
the sort field with about two digits more than I'd ever expect to use.  Or,
if I wanted a numeric sort key, I'd parse the string, and compute:

  1,000,000*8 + 1,000*23 + 456

Again, using mucho extra digits just to avoid the need for redesign.  (Do you
remember when 40 MB was a biiiiiigggggg hard drive?)

Aside to rudy: you're right, but I explained it more awsomely.  ;-)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll                          MailTo:Ed at ComSimplicity.com
ComSimplicity                                      (310) 838-4330
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -





More information about the thelist mailing list