Spaces When Alphabetizing

Should you count them?

By Deane Barker

Usually, yes.

We don’t normally encounter this problem because it’s not common (outside of computing) to order multi-word phrases.

A space is usually considered to come before all other letters, when sorting words into alphabetical order (see below for a specific example). Essentially, you sort by first word. If the first word is the same, you include the second word, and so on.

However, this is not absolute. In some cases (dictionaries, for instance), spaces will be removed or “collapsed,” and the words ordered based on what’s left.

Why I Looked It Up

When viewing the alphabetical list in my library, I found this oddity:

That didn’t seem right – I felt like “Big Secrets” should come first because “Big” should come before “Bigger.” It turns out I was removing the spaces, so the two titles look like this to the computer:

The first two letters are the same, but without the space, the third and fourth letters are:

  • gg
  • gS

And that explains the sorting. I changed the code to keep the space, and the sorting reversed.

This is item #824 in a sequence of 961 items.

You can use your left/right arrow keys to navigate