[Overview][Resource strings][Constants][Types][Procedures and functions][Index] Reference for unit 'strutils' (#rtl)

GetCmdLineArg

Returns the command-line argument following the given switch.

Declaration

Source position: strutils.pp line 190

function GetCmdLineArg(

  const Switch: string;

  SwitchChars: TSysCharSet

):string;

Arguments

Switch

  

Switch to search for

SwitchChars

  

Switch characters to use. Can be empty.

Function result

Command line argument that followed the switch

Description

GetCmdLineArg returns the value for the Switch option on the command-line, if any is given. Command-line arguments are considered switches if they start with one of the characters in the SwitchChars set. The value is the command-line argument following the switch command-line argument.

Gnu-style (long) Options of the form switch=value are not supported.

The StdSwitchChars constant can be used as value for the SwitchChars parameter.

Errors

The GetCmdLineArg does not check whether the value of the option does not start with a switch character. i.e.

myprogram -option1 -option2

will result in "-option2" as the result of the GetCmdLineArg call for option1.

See also

StdSwitchChars

  

Standard characters for the SwitchChars argument of GetCmdLineArg.


Documentation generated on: Sep 28 2017