Jump to content

Parameter Functions


RobYost

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;

Link to comment
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;
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...