This function decodes strings that have been jumbled by the MagicEncoder function. The supplied code string ( theCode ) must be exactly the same as the string used to encode theText.
TheCode must contain every letter of the alphabet plus a space which is expected as the last character. If the space is placed elsewhere in the code string word breaks will be changed.
MagicDecoder (theText;theCode)
Let ( alpha = "abcdefghijklmnopqrstuvwxyz " ;
If ( Length ( theText ) > 1;
Middle ( alpha ; Position ( theCode ; Middle ( theText ; 1 ; 1 ) ; 1 ; 1 ) ; 1 ) & MagicDecoder ( Right ( theText; Length ( theText ) - 1 ); theCode );
Middle ( alpha ; Position ( theCode ; theText ; 1; 1 ) ; 1 )
)
)
