
Are you a QOTWer? Do you want to start a thread that isn't a direct answer to the current QOTW? Then this place, gentle poster, is your friend.
( , Sun 1 Apr 2001, 1:00)
« Go Back | See The Full Thread

are absolutely necessary when using a computer. Most computers sort numbers alphabetically, like words. They sort on the first character, then the second character and so on.
This means that anything beginning with a '0' will be ordered before anything beginning with a higher number. This is a total pain in the ass, because once you start using more than one numerical digit, i.e. numbers higher than 9, it's still only the leading digit which dictates where it gets sorted.
This has scuppered me many times in the past. Short-sighted planning results in things being named with too few digits, which means that when the digits roll over (say from 999 to 1000) the new entries appear in the wrong place in a sorted list. Everything from 1000 to 2000 gets sorted after the the 1s but before the 2s, like this:
1
1011
1345
1999
2
3
4
5
6
But not if you use leading zeroes:
0001
0002
0003
0004
0005
0006
1011
1345
1999
So people, leading zeroes are your friends. Build in the right number of digits at the start or be raped by sorting algorithms later.
( , Wed 5 Nov 2008, 8:25, Reply)
« Go Back | See The Full Thread