Function syntax consists of a start and end tag, the function name to be enclosed in curly brackets. Take at least one parameter as "argument". Some take additional parameters separated by colon characters. Generic syntax:
{functionname_start:optionalargument1:optionalargument2}argument{functionname_end}The arguments can be text or numeric literals or server variables. Special case of optional arguments, when these contain the colon (:) character itself, that needs to be manually encoded as ~..~. The functions are processed by the replacement engine in this very order of sequence as listed here.
General purpose#
Encrypts the inner data in DES format.
encrypt_startURL encodes the inner data.
encode_startURL decodes the inner data.
decode_startVRL encodes the inner data....@ becomes {at}, % becomes {percent} etc.
vrlencode_startVRL decodes the inner data. {at} becomes @ etc
vrldecode_startConverts the inner data to uppercase.
upper_startConverts the inner data to lowercase.
lower_startCreates a MD5 hash of the inner data.
md5_startCuts off the last part of a path string in the inner data. So /folder1/folder2/folder3/ would become /folder1/folder2/
chop_startCleans up HTML data to remove its tags with a regex expression.
htmlclean_startCleans up HTML data to remove tags using a different non regex algorithm.
htmlclean2_startGets the last element of a path in the inner data. Example: {last_start}/folder1/folder2/file.txt{last_end} results in file.txt
last_startTrims off white space on the ends of the inner data.
trim_startSafeguards the text for raw SQL preventing ' and; and %, etc risks in the input text.
sql_startFinds a location of a string. Example: {indexof_start:thing:-1}something to search in{indexof_end} it searches for the location of 'thing' in that text starting from the right side moving backwards. The -1 means a negative search, where a -5 would mean a negative search starting from position 5. A 0 would mean start at the beginning.
indexof_startGrab a part of a string. Example: {substring_start:2:5}something to find{substring_end} would result in 'met'
Example_2: {substring_start:-4:-1}something to find{substring_end} would result in 'find'
The -4 is 4 from the end, and the -1 means all the way to the end. If you did a positive 1 it would do 1 character from the 4th character to the end.
substring_startSplit a string into pieces with the character(s) specified. Example: {split_start:_:3}this_is_a_test_for_split{split_end} would result in the 3rd item which is the word 'test'
split_startChange a part of the string. Example: {replace_start:test:big_test}this_is_a_test_for_replace{replace_end}
replace_startAdd one to the value assumed to be an integer. {increment_start}50{increment_end} results in a value of 51.
increment_startOpposite of increment.
decrement_startAdd an amount to the number. Example: {add_start:500}1000{add_end} results in 1500.
add_startParsing a date to a millisecond value. Example: {parse_start:MMddyy HH~..~mm~..~ss}042578 22:43:12{parse_end} Note how the sideways colon is used to represent the colon since colon is our separator character. ~..~ means: in functions where that scenario occurs. For strict parsing use character '=' at the beginning of the date format like {parse_start:=MM/dd/yyyy}. It will parse only valid dates and fails for example for 13/02/2022 (Month maximum number is 12).
parse_startDo the opposite, producing a formatted date. {rparse_start:MMddyy HH~..~mm~..~ss}12345678923{rparse_end} would result in some date formatted value.
rparse_startGrab a part of a formatted URL. Example: {url_start:host}ftp://demo:demo@crushftp.com/demo/folder/file.txt{url_end} would result in 'crushftp.com'. Valid items: protocol, user, pass, host, port, path, file, and query in this order.
url_startGet the length of the inner data. Example: {length_start}blah{length_end} would result in 4.
length_startDo very basic math operations on text formatted math. Example: {math_start:l}5+5{math_end} would result in 10. The l is for LONG. f is for FLOAT. i is for INTEGER. d is for big numbers (double of the integer) which is the default. So {math_start:f}5+5{math_end} would result in 10.0
math_startReference a list of user attributes, separated by a delimitator character, of a group of users. Example: {group_start:email:MainUsers:,}Mygroup{group_end} comma-separated list of user e-mail addresses members of Mygroup from MainUsers connection group
group_startTrace geographically an IP using https://freegeoip.net, for example {geoip_start}{user_ip}{geoip_end} in a user task
geoip_startTurn off function replacement. If the text starts with the variable {ignore_functions} function replacement will be turned off.
ignore_functionsLog custom text to CrushFTP.log
{log_start}some text, or {variables}{log_end}
Special functions that only work in the UserVariable task
#
Save, Load, and Add to named list items in a job flow. (UserVariable task only) (CrushFTP 10.3.0_43+ supports this)Save a copy of the current list to the name in the function (applying the filter of the UserVariable task)
save_list_startLoad a list into the current list and start using it. The existing list is discarded.
load_list_startAdd the current item to a named list.
add_list_start
Parse in a JSON object, explode to a list of key name - key value pairs
json_parse_startUse it like {json_parse_start}{myJson}{json_parse_end} with it's argument a variable referencing a JSON object. Can dereference a particular key value with the key name enclosed in curly brackets ( like {mykey1} ). Doesn't work with nested JSON structures.
Parse in an XML file, explode to a list of key name - key value pairs
{xml_parse_start}{file_contents}{xml_parse_end}
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This particular version was published on 08-Oct-2024 09:00 by krivacsz.
G’day (anonymous guest)
Log in
JSPWiki