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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...