English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

8 answers

Because 7 comes before 1.

To avoid the problem, you could use 07, 08, 09, 10 etc, depending on where you're storing stuff.

When I name folders here at work for clients, I name by date as follows, which avoids the problem:

2006_09_28 - that way, everything stays in order.

2006-09-27 21:36:37 · answer #1 · answered by mattygroves 3 · 0 0

"Numbers" can be represented in two completely different ways in a computer. When 7 comes after 12, they are stored as a series of characters and sorted alphabetically. When 7 comes before 12, they are stored as a number and sorted numerically.

When 4567 is stored numerically on a 32 bit computer, the cpu sees 4567.

When 4567 is stored as a series of characters, the cpu sees 0034003500360037. inefficient both in terms of cpu processing time and disk storage space!


p.s. I love storing dates in YYYYMMDD format because it solves all kinds of Internationalization problems. Representing dates in strictly numerical format such as 20060928 in databases is much better than the character based method of 2006-09-28 because the first can be processed exponentially faster and take up less space.

p.s.s. i ignored "endianess" for the sake of clarity.

2006-09-27 21:56:46 · answer #2 · answered by Robert T 1 · 0 0

When you store a number as a string. To you a number is a number but to a computer a string and a number are complete different. A number stored as a string will be sorted by the ascii value of the of the character that describes the number.

If you want a number to be sorted correctly or to return the correct results when used in a comparision that you must you it as a number and not as a string.

2006-09-27 21:46:55 · answer #3 · answered by Paul B 3 · 0 0

It looks at the first digit, in this case 1 and that comes before 7.
It will then look at the second digit eg 12 comes before 17.
And so on

Hence, for example 1, 12 , 123, 17 ,7, 81, 87

2006-09-27 21:30:46 · answer #4 · answered by Anonymous · 1 0

It's annoying sometimes, true, but that's just the way it is, 1 comes before 7, so 12 comes before 7, hence a sort will show up like this:

1
10
11
12
2
3
etc

2006-09-27 21:33:48 · answer #5 · answered by Walter W. Krijthe 4 · 0 0

If you want to store something in the right order I would suggest using the a1,a2,a3 - a9 form, this will give you 236 options or 1a,1b,1c - 1z, or go for the 001,002,003 - 999, 0r if you are going mad 001a,001b,001c - 999z.
I know renaming is a pain so if you have a large group try subdividing them into seperate folders or even better group them by name and number.

2006-09-27 21:43:25 · answer #6 · answered by David Computer Guy 4 · 0 0

Because Mars is before Saturn's breakfast.

2006-09-27 21:36:22 · answer #7 · answered by L S 3 · 0 0

Is it because, in alphabetical order, seven comes before twelve?

2006-09-27 21:30:56 · answer #8 · answered by Pango 5 · 0 0

fedest.com, questions and answers