prefix-separated list

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Revision as of 00:55, 12 September 2010 by Woozle (talk | contribs) (Created page with '==About== category:computer terminologyA prefix-separated list is a way of encoding a short list of static values of varying length within a single string. ==Benefits== I…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

A prefix-separated list is a way of encoding a short list of static values of varying length within a single string.

Benefits

It is easy to handle in code, as there are no special escape sequences to look for. It also stores the values very efficiently, requiring only an extra character (the separator) per list element. It also eliminates the hassle of having to separately specify the separator, since this is specified within the data.

Format

The rule is that the first character in the string is the character which separates the list elements. While this means that it is not possible to represent every possible character simultaneously within a list, in real-world usage it is usually trivially easy to find an unused character which is visually satisfying as a separator.

Examples

  • /one/two/three/four
  • .first.second.third.fourth.fifth
  • :Monday:Tuesday:Wednesday:Thursday:Friday:Saturday:Sunday

Notes

As far as I know, I'm the only one who uses this technique; I haven't seen it anywhere else. So maybe it's only useful to my weird brain. --Woozle 00:55, 12 September 2010 (UTC)