[Overview][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'LazUTF8' (#lazutils)

ParamStrUTF8

Gets the specified command line parameter and converts it to a UTF-8-encoded string.

Declaration

Source position: lazutf8.pas line 63

function ParamStrUTF8(

  Param: Integer

):string;

Arguments

Param

  

Ordinal position for the command line parameter retrieved in the routine.

Function result

UTF-8-encoded value for the specified command line parameter.

Description

ParamStrUTF8 is a String function used to convert the specified command line parameter to a UTF-8-encoded string. The implementation for ParamStrUTF8 is OS- or platform-specific. For UNIX-like environments, SysToUTF8 is called to convert the value for the command line parameter at the position in Param. For Windows platforms, the stub for the Ansi or WideString version of ParamStrUTF8 is called. ParamStrUTF8 is the UTF-8-enabled counterpart to the ParamStr routine in RTL.

Index is the ordinal position for the requested parameter value. Index should be in the range 0..ParamCount. Values in Index outside this range cause an empty string ('') to be returned for a parameter value.

In most cases, the parameter at position 0 contains the name and optional path to the executable file for the application. For cross-platform compatibility, use the ExeName property in TCustomApplication to get the path and name for the binary instead. Subsequent index positions contain any command line arguments passed to the executable.

The return value contains the UTF-8-encoded string with the value for the parameter at the specified position, or an empty string when not present.

See also

SysToUTF8

  

Converts strings (and format settings) from the system codepage to UTF-8.

TCustomApplication.ExeName

ParamStr


Version 4.0 Generated 2025-05-03 Home