Description |
The TSysCharSet type is used as a general type for setting special characters during Delphi string parsing functions.
For example, the FindCmdLineSwitch can be configured to search for user defined command line 'switch' value prefix characters.
|
|
Related commands |
|
|
|
Example code : Override the default Windows Command Line Switch parsing characters |
var
switchPrefixes : TSysCharSet;
begin // Before running this code, use the Run/parameters menu option // to set the following command line parameters : *def /abc ShowMessage(CmdLine); // Show the execution command + parameters
// How many parameters were passed?
ShowMessage('There are '+IntToStr(ParamCount)+' parameters');
// Scan for abc and def parameters using the default / and - values
if FindCmdLineSwitch('abc')
then ShowMessage('/abc found')
else ShowMessage('/abc NOT found');
if FindCmdLineSwitch('def')
then ShowMessage('/def found')
else ShowMessage('/def NOT found');
// Rescan with * and / as the switch prefix characters
switchPrefixes := ['*','/'];
if FindCmdLineSwitch('abc', switchPrefixes, True)
then ShowMessage('*abc or /abc found')
else ShowMessage('*abc and /abc NOT found');
if FindCmdLineSwitch('def', switchPrefixes, True)
then ShowMessage('*def or /def found')
else ShowMessage('*def and /def NOT found');
end;
|
Show full unit code |
"C:\Program files\Borland\Delphi7\Projects\Project1.exe" *def /abc
/abc found
/def NOT found
*abc or /abc found
*def or /def found
|
|