24-Apr-06 (Created: 24-Apr-06) | More in '05.03-Meta Principles'

The Great Escape Character ..

An escape character is an awful lot of fun in programming. It seem to have the ability to allow multiple dimensions where only one dimension is allowed. A disguise, a ruse, a ploy, almost always clever getting out of tight squeezes.

An encode function

Here is a function that I am very fond of


escapedString = 
encode(oldString, 
   escapeChar, 
   oldCharacter, 
   newCharacter);

The function will replace every old character with the new character with a preceding escape character. The function will also escape the escape character itself.

Allowing for multiple character translation


escapedString = 
encode(oldString, 
   escapeChar, 
   oldCharacterString, 
   newCharacterString);