Jump to content


Photo

Parameter Functions


  • Please log in to reply
1 reply to this topic

#1 RobYost

RobYost

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 175 posts
  • LocationFlorida, USA

Posted 14 November 2017 - 03:08 PM

// =============================================================================
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;

  • 0

http://unigui.mirahe.../wiki/Main_Page

Please add any utilities you think are useful. I will try to keep the wiki organized.


#2 multimesut

multimesut

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 73 posts

Posted 16 November 2017 - 09:20 AM

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;

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users