Delimiters

Handling delimiters.

Posted by dbunker on July 19, 2011

In case of sending “&” down the wire being forbidden because it is used elsewhere as a delimiter, the method below packages and then unpackages text to still allow user input with the character “&”.

To package, perform these string replacements:

  • “/” → “/+”
  • “&” → “/*”

To unpackage, perform these string replacements:

  • “/*” → “&”
  • “/+” → “/”

This is a common problem and this solution would most likely go in the “escape sequence” category.