delimiter-prefixed string

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

About

In coding, a delimiter-prefixed string is a string value that contains single-character-delimited substrings of variable length where the delimiting character is always included as the first character of the string.

This eliminates the need to define or pass the delimiting character separately, which makes it easy to store lists of short strings as a single value. The only constraint this adds is that the delimiting character must not appear in any of the substrings; this technique is therefore most useful for predefined constants, where a character can be chosen that won't conflict with the substring values and hopefully will help to visually set the values apart.

Examples:

  • "/one/two/three/four" (dividing char = "/")
  • " Monday Tuesday Wednesday Thursday Friday Saturday Sunday" (dividing char = space)