Set string

Purpose: Set value of a string variable.

 set-string <variable> [ = <string> ] [ process-scope ] [ unquoted ]

String variable <variable> will be assigned a value of <string> if clause "=" is present; otherwise <variable> is assigned an empty string.

If "process-scope" clause is used, then <variable> will be of process scope, meaning its value will persist from one request to another for the life of the process; this clause can only be used if <variable> did not already exist.

If "unquoted" clause is used, then <string> literal is unquoted, and everything from equal clause ("=") to the rest of the line is a <string>; in this case there is no need to escape double quotes or backslashes. Note that in this case, "unquoted" and any other clause must appear prior to equal clause ("=") and after variable, because they wouldn't otherwise be recognized. For instance:
 set-string my_string unquoted = this is "some" string where there escape characters like \n do "not work"

This is the same as:
 set-string my_string = "this is \"some\" string where there escape characters like \\n do \"not work\""

"unquoted" clause is useful when writing string literals that would otherwise need lots of escaping.
Examples
Initialize "my_string" variable to "":
 set-string my_string

Initialize "my_string" variable to "abc":
 set-string my_string = "abc"

See also
Strings
copy-string  
count-substring  
delete-string  
lower-string  
read-split  
replace-string  
set-string  
split-string  
string-length  
trim-string  
upper-string  
write-string  
See all
documentation


Copyright (c) 2019-2024 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.