Exists class method

Project: Environment Variables Unit

Unit: PJEnvVars

Class: TPJEnvironmentVars

Applies to: ~>3.0

class function Exists(const VarName: string): Boolean;

Description

Checks if a given environment variable exists in the current process.

Parameters:

Returns

Important: Don’t be tempted to simply check if the GetValue method returns the empty string to determine whether an environment variable exists or not. GetValue will return the empty string in two cases: (1) if the environment variable exists but has an empty value and (2) if the environment variable does not exist. Exists returns True in the former case and False in the latter.