Function BaseXTable(xNum: Variant; nBase: Extended; lSwStr: Boolean): Variant;
Var
xTmp: Variant;
nTmp: LongInt;
lError: Boolean;
Begin
nTmp := 0;
lError := False;
If (IsRange(nBase, 2, 252) <> False) Then Begin
If (lSwStr <> True) Then Begin
If (IsRange(xNum, 0, 9) <> False) Then xTmp := Char(xNum + 48) Else
If (IsRange(xNum, 10, 35) <> False) Then xTmp := Char(xNum + 55) Else
If (IsRange(xNum, 36, 61) <> False) Then xTmp := Char(xNum + 61) Else
If (xNum = 62) Then xTmp := #043 Else
If (xNum = 63) Then xTmp := #047 Else
If (IsRange(xNum, 64, 196) <> False) Then xTmp := Char(xNum + 59) Else
If (IsRange(xNum, 197, 202) <> False) Then xTmp := Char(xNum - 106) Else
If (IsRange(xNum, 203, 209) <> False) Then xTmp := Char(xNum - 145) Else
If (xNum = 210) Then xTmp := #044 Else
If (IsRange(xNum, 211, 220) <> False) Then xTmp := Char(xNum - 178) Else
If (IsRange(xNum, 221, 238) <> False) Then xTmp := Char(xNum - 207) Else
If (IsRange(xNum, 239, 251) <> False) Then xTmp := Char(xNum - 238);
End Else If (lSwStr <> False) Then Begin
cTmp := xNum.Trim;
If (nBase <= 36) Then cTmp := UpperCase(cTmp);
nTmp := Byte(cTmp[1]);
If (IsRange(nTmp, 48, 57) <> False) Then xTmp := (nTmp - 48) Else
If (IsRange(nTmp, 65, 90) <> False) Then xTmp := (nTmp - 55) Else
If (IsRange(nTmp, 97, 122) <> False) Then xTmp := (nTmp - 61) Else
If (nTmp = 43) Then xTmp := (62) Else
If (nTmp = 47) Then xTmp := (63) Else
If (IsRange(nTmp, 123, 255) <> False) Then xTmp := (nTmp - 59) Else
If (IsRange(nTmp, 91, 96) <> False) Then xTmp := (nTmp + 106) Else
If (IsRange(nTmp, 58, 64) <> False) Then xTmp := (nTmp + 145) Else
If (nTmp = 44) Then xTmp := (210) Else
If (IsRange(nTmp, 33, 42) <> False) Then xTmp := (nTmp + 178) Else
If (IsRange(nTmp, 14, 31) <> False) Then xTmp := (nTmp + 207) Else
If (IsRange(nTmp, 1, 13) <> False) Then xTmp := (nTmp + 238);
If (xTmp >= nBase) Then lError := True;
End;
End;
If (lError <> True) Then Result := xTmp Else Result := '*** Error ***';
End;