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?
WriteLn('There are '+IntToStr(ParamCount)+' parameters');
// Scan for abc and def parameters using the default / and - values
if FindCmdLineSwitch('abc')
then WriteLn('/abc found')
else WriteLn('/abc NOT found');
if FindCmdLineSwitch('def')
then WriteLn('/def found')
else WriteLn('/def NOT found');
// Rescan with * and / as the switch prefix characters
switchPrefixes := ['*','/'];
if FindCmdLineSwitch('abc', switchPrefixes, True)
then WriteLn('*abc or /abc found')
else WriteLn('*abc and /abc NOT found');
if FindCmdLineSwitch('def', switchPrefixes, True)
then WriteLn('*def or /def found')
else WriteLn('*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
|
|