[Overview][Types][Classes][Variables][Index] | Reference for unit 'CustApp' (#fcl)

# TCustomApplication.GetOptionValue

Return the value of a command-line option.

## Declaration

Source position: custapp.pp line 71

`public function TCustomApplication.GetOptionValue(`
`const S: string`
`):string; function TCustomApplication.GetOptionValue(`
`const C: Char;`
`const S: string`
`):string;`

## Arguments

`S` |  | Long option string

## Function result

Option value, or empty string.

## Arguments

`C` |  | Short option character
`S` |  | Long option string

## Description

GetOptionValue returns the value of an option. Values are specified in the usual GNU option format, either of

    --longopt=Value

or

    -c Value

is supported.

The function returns the specified value, or the empty string if none was specified.

Depending on the value of the CaseSensitiveOptions property, the search is performed case sensitive or case insensitive.

Options are identified as command-line parameters which start with OptionChar (by default the dash ('-') character).

If an option can appear multiple times, use TCustomApplication.GetOptionValues to retrieve all values. This function only returns the value of the first occurrence of an option.

## See also

FindOptionIndex |  | Return the index of an option.
HasOption |  | Check whether an option was specified.
CheckOptions |  | Check whether all given options on the command-line are valid.
CaseSensitiveOptions |  | Are options interpreted case sensitive or not
OptionChar |  | Command-line switch character
TCustomApplication.GetOptionValues |  | Get the values for an option that may be specified multiple times

Documentation generated on: May 14 2021