String Expansion
- Last Updated: April 16, 2025
- 1 minute read
- WS_FTP Pro
- Version 12.9
String Expansion
Some of the commands and functions in the FireScript language take strings as arguments. To these you may either pass a string variable or a string literal surrounded by double quotes, e.g. “This is a string.” To put a double quote inside a string, preface it with the percent sign '%'. The percent sign '%' is used as an escape character to embed variables and quote characters in strings.
The sequence %% is replaced by a single %. The sequence %" is replaced by ".% followed by the name of a variable is replaced by the value of the variable.
For example, the script statement below:
send ("OPEN %HostAddress")If HostAddress is equal to “ftp.progress.com” when this script is invoked, the command will be expanded to:
send ("OPEN ftp.progress.com")the expression,
contains (lastreply, "%% full")will be expanded at runtime to:
contains(lastreply "% full")and the statement
send ("SITE SETLOG %"f:\log files\access.log%" -clear")the expanded string sent will be:
SITE SETLOG "f:\log files\access.log" -clearPassing a string variable is equivalent to, but faster than passing a string literal that expands the variable.
Example:
isempty(FwPassword)is equivalent to but faster than
isempty("%FwPassword")