{***********************************************************************}
{									}
{ __XlateStr  String translation					}
{									}
{ function  __XlateStr(Source, Table, Trans : string) : string; 	}
{									}
{	      Source	The string to be translated.			}
{	      Table	The string representing the characters from	}
{			the source string which are to be translated.	}
{	      Trans	The translation of the corresponding characters }
{			in the table string.				}
{									}
{ Description The source string is converted by translating each char-	}
{	      acter in the source string which is in the table to the	}
{	      corresponding character in the translation string.	}
{	      Formally, if Source is the empty string, the functional	}
{	      value is the empty string.  If Source is not empty, for	}
{	      each character, Source[K], of Source, the corresponding	}
{	      character of the functional result, Target[K], is con-	}
{	      structed as follows:					}
{									}
{	      Target[K] = Source[K] if Source[K] is not in Table.	}
{	      Target[K] = ' ' (blank) if the position of Source[K] in	}
{			  Table is greater than the length of Trans.	}
{	      Target[K] = Trans[J] if the position of Source[K] in	}
{			  Table is J.					}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

function  __XlateStr(Source, Table, Trans : string) : string;

  const
    BLANK     = #32;

  var
    I,J       : word;
    LenSource : word;
    LenTrans  : word;
    Target    : string;

  begin {__XlateStr}

    LenTrans  := Length(Trans);
    LenSource := Length(Source);

    for I := 1 to LenSource do
      begin
	J := Pos(Source[I],Table);     { Is the character in the table? }
	if (J > 0) then
	   if (J > LenTrans) then      { Yes... 			}
	      Target[I] := BLANK       { but not in Trans, so a blank.	}
	   else
	      Target[I] := Trans[J]    { and it is in the Trans string. }
	else			       { No...				}
	   Target[I] := Source[I]      { so do not alter the character. }
      end;

    Length(Target)  := LenSource;
    __XlateStr	    := Target

  end;	{__XlateStr}
