function Mnemo_Extract(Sx:string):string;
//Выделить мнемокод из строки
Var
  N:integer;
begin
  Result:='';
  Sx:=trim(Sx);
  N:=POS('${',Sx);
  if N>0 then begin
     Sx:=trim(Delete_start_String(Sx, N+1));
     N:=POS('}',Sx);
     if N>0 then begin
        Result:=trim(Delete_end_String(Sx, N));
     end;
  end;
end;

function Delete_end_String(Sx : string; Index:integer) : string;
//Удалить окончание строки, начиная с заданой позиции
begin
  Result:=Sx;
  if length(Sx)>0 then begin
     if Index>0 then begin
        System.Delete(Result, Index, length(Result)+1);
     end;
  end;
end;

function Delete_start_String(Sx : string; Index:integer) : string;
//Удалить начало строки, начиная с 1-й позиции и до заданной (включая заданную)
begin
  Result:=Sx;
  if length(Sx)>0 then begin
     if Index>0 then begin
        System.Delete(Result, 1, Index);
     end;
  end;
end;