> For the complete documentation index, see [llms.txt](https://docs.cloud.hoverfly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloud.hoverfly.io/create-simulations/using-templating-in-simulations/useful-helper-functions.md).

# Useful helper functions

### Concatenate two strings

```handlebars
{{ concat '<string1>' '<string2>' }}
```

### Search and replace text in a string

```handlebars
{{ replace '<string-to-search>' '<string-to-replace>' '<replacement-string>' }}
```

### Create an array from a delimited string

This can be particularly useful when dealing with the results of a JSONPath query that returns an array, as these are space delimited strings of values.

```handlebars
{{ split '<delimited-string>' '<delimiter>' }}
```

### Change the HTTP response code

If you are following a pattern where you want a single request/response pair to return different HTTP response codes based on the outcome of logic, then you can do that using the following function:

```handlebars
{{ setStatusCode <any-valid-http-response-code> }}
```

### Set the value of an HTTP response header

You can set the value of an HTTP header dynamically from script:

```handlebars
{{ setHeader '<header-name>' '<new-value>'}}
```
