# CrushTask Functions

All have a start and end and use curly brackets. Some take additional parameters separated by colons. :

They are also processed in this order of sequence as listed here:

Encrypts the inner data in DES format.

```
encrypt_start
```

URL encodes the inner data.

```
encode_start
```

URL decodes the inner data.

```
decode_start
```

VRL encodes the inner data....@ becomes {at}, % becomes {percent} etc.

```
vrlencode_start
```

VRL decodes the inner data. {at} becomes @ etc

```
vrldecode_start
```

Converts the inner data to uppercase.

```
upper_start
```

Converts the inner data to lowercase.

```
lower_start
```

Creates a MD5 hash of the inner data.

```
md5_start
```

Cuts off the last part of a path string in the inner data. So /folder1/folder2/folder3/ would become /folder1/folder2/

```
chop_start
```

Cleans up HTML data to remove its tags with a regex expression.

```
htmlclean_start
```

Cleans up HTML data to remove tags using a different non regex algorithm.

```
htmlclean2_start
```

Gets the last element of a path in the inner data. Example: {last_start}/folder1/folder2/file.txt{last_end} results in file.txt

```
last_start
```

Trims off white space on the ends of the inner data.

```
trim_start 
```

Safeguards the text for raw SQL preventing ' and; and %, etc risks in the input text.

```
sql_start
```

Finds 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_start
```

Grab 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_start
```

Split 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_start
```

Change a part of the string. Example: {replace_start:test:big_test}this_is_a_test_for_replace{replace_end}

```
replace_start
```

Add one to the value assumed to be an integer. {increment_start}50{increment_end} results in a value of 51.

```
increment_start
```

Opposite of increment.

```
decrement_start
```

Add an amount to the number. Example: {add_start:500}1000{add_end} results in 1500.

```
add_start
```

Parsing 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_start
```

Do the opposite, producing a formatted date. {rparse_start:MMddyy HH\~..\~mm\~..\~ss}12345678923{rparse_end} would result in some date formatted value.

```
rparse_start
```

Grab 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_start
```

Get the length of the inner data. Example: {length_start}blah{length_end} would result in 4.

```
length_start
```

Do 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_start
```

Reference 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_start
```

Trace geographically an IP using https<!-- -->://freegeoip.net, for example {geoip_start}{user_ip}{geoip_end} in a user task

```
geoip_start
```

Turn off function replacement. If the text starts with the variable {ignore_functions} function replacement will be turned off.

```
ignore_functions
```

Log custom text to CrushFTP.log

```
{log_start}some text, or {variables}{log_end}
```

#### 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_start
```

Load a list into the current list and start using it. The existing list is discarded.

```
load_list_start
```

Add the current item to a named list.

```
add_list_start
```
