Jump to content
uniGUI Discussion Forums
RobYost

Parameter Functions

Recommended Posts



// =============================================================================
function rtnAllParms(): String;
var
  i: Integer;
  p: String;
begin
  for i := 0 to UniApplication.Parameters.count - 1 do
  begin
    p := p + '&' + UniApplication.Parameters[i];
  end;
  Result := p;
end;




//This way you can pass a parameter without '=true'
//example: www.xxx.com?Demo&LoadData
// if(ParmExists('Demo') then DoSomething
// =============================================================================
function ParmExists(aParm: string): Boolean;
var
  i: Integer;
begin
  Result := False;
  for i  := 0 to UniApplication.Parameters.count - 1 do
  begin
    if (UpperCase(aParm) = UpperCase(Copy(UniApplication.Parameters[i], 1, Length(aParm)))) then
    begin
      Result := True;
      Break;
    end;
  end;
end;




// =============================================================================
function DeleteParm(aParm: string): Boolean;
var
  i: Integer;
begin
  Result := False;
  for i  := 0 to UniApplication.Parameters.count - 1 do
  begin
    if (UpperCase(aParm) = UpperCase(Copy(UniApplication.Parameters[i], 1, Length(aParm)))) then
    begin
      UniApplication.Parameters.Delete(i);
    end;
  end;
end;

Share this post


Link to post
Share on other sites

Thank you. And

function ParmValue(aParm: string): String;
var
  i: Integer;
begin
  Result := '';
  for i  := 0 to UniApplication.Parameters.count - 1 do
  begin
    if (UpperCase(aParm) = UpperCase(Copy(UniApplication.Parameters[i], 1, Length(aParm)))) then
    begin
      Result := UniApplication.Parameters.Values[aParm];
      Break;
    end;
  end;
end;

Share this post


Link to post
Share on other sites

×