Skip to main content

Using Filters in XanoScript

Filters in XanoScript are applied right after the target value using a | pipe character. As an example, we have a text string stored in a variable called x1. We want to apply a capitalize filter to it. This is what defining the variable would look like in XanoScript.
    var x1 {
      value = "hello"
    }
When we add the filter, it looks like this.
    var x1 {
      value = "hello"|capitalize
    }
If a filter has parameters required to use it, we can use : characters to add and separate them. As an example, we’ll take our text string and use the concat filter to append additional text to it with a separator. "hello" will become "hello, world". The concat filter asks for two parameters: a value and a separator. We’ll use : to separate each parameter.
    var x1 {
      value = "hello"|concat:"world":", "
    }
You can add multiple filters by separating each one with pipe characters.
      value = "hello"|concat:"world":", "|capitalize
You can also nest filters. In this example, we’re using the capitalize filter specifically on "world" inside of the concat filter.
      value = "hello"|concat:"world"|capitalize:", "

Filter Reference

Manipulation

 

Math

 

Timestamp

 

Text

 

Array

 

Transform

 

Comparison

 

Security

 
I