Data Management

Xano - Text

Summary

In Xano, you can easily manipulate text and use various text filters to modify and format your data. Whether you're a non-technical user or an experienced developer, Xano's visual interface makes it simple to work with text without writing any code. In this step-by-step guide, we'll explore how to manipulate text and utilize text filters in Xano.

Prepending and Appending Text

One of the basic text manipulation functions in Xano is the ability to prepend (add text before) or append (add text after) an existing variable.

  1. First, create a variable that contains the text you want to modify. For example, let's create a variable called `var1` with the value `"hello world"`.
  2. In your function stack, go to the "Data Manipulation" section and click on the "Text" option.
  3. To prepend text, choose the "Prepend" function and click on the variable you want to modify (`var1` in our case). Enter the text you want to add before the variable (e.g., "XXXX").
  4. Click "Save" and run the function to see the result. In this example, the output will be "XXXXhello world".
  5. Similarly, to append text, choose the "Append" function and follow the same steps, but this time, enter the text you want to add after the variable.

Trimming Text

Xano also provides functions to trim characters from the beginning, end, or both sides of a text variable.

  1. In the "Text" section of the "Data Manipulation" menu, you'll find the "Trim", "Left Trim", and "Right Trim" functions.
  2. Let's say you want to remove the "XXXX" you prepended earlier. Choose the "Left Trim" function, click on `var1`, and enter "X" as the value to trim.
  3. Click "Save" and run the function to see the updated result, which should be "hello world" without the prepended "XXXX".

Using Text Filters

Xano offers a powerful set of text filters that allow you to perform various operations on your text data. These filters can be found in the "Data Manipulation" section, under the "Add Filter" option.

  1. To use a text filter, create a new variable or update an existing one.
  2. Click on "Add Filter" and choose the desired text filter from the list (e.g., "Concatenate", "Capitalize", "Index", "Split", etc.).
  3. Each filter will have its own set of options and parameters. For example, the "Concatenate" filter allows you to combine multiple strings and specify a separator.
  4. After configuring the filter options, click "Update" and "Save" to apply the changes.
  5. Run the function to see the filtered result.

Here's an example of using the "Concatenate" filter:

  1. Create a new variable called `var2` with the value `"hi there"`.
  2. Add the "Concatenate" filter to `var2`.
  3. In the filter options, enter `"from Xano"` as the value to concatenate and `" + "` as the separator.
  4. Click "Update" and "Save".
  5. Run the function, and the result will be `"hi there + from Xano"`.

Using Text Filters for Conditional Statements

Xano's text filters can also be used in conjunction with conditional statements, making it easy to perform checks and take different actions based on the text content. The "Starts With", "Ends With", and "Contains" filters are particularly useful for this purpose.

  1. In the "Text" section of the "Data Manipulation" menu, choose the desired filter (e.g., "Starts With").
  2. Select the variable you want to check and enter the value you're looking for (e.g., "H" for checking if a string starts with "H").
  3. Provide a name for the result variable (e.g., `var1_result`).
  4. Click "Save" and run the function to get the boolean result.
  5. You can then use this result variable in a conditional statement to perform different actions based on the outcome.

For example, you could create an "If" statement in the "Conditional" section of the "Data Manipulation" menu, using `var1_result` as the condition. If the condition is true, you can execute a set of actions defined in the "Then" statements.

By following these step-by-step instructions, you'll be able to easily manipulate text and use text filters in Xano, regardless of your technical background. Xano's visual interface and user-friendly features make it accessible for non-technical users, citizen developers, and experienced developers alike, enabling them to build and deploy backend services for their web and mobile applications without writing code.

This transcript was AI generated to allow users to quickly answer technical questions about Xano.

Was this helpful?

I found it helpful

I need more support
Sign up for XanoSign up for Xano

Build without limits on a secure, scalable backend.

Unblock your team's progress and create a backend that will scale for free.

Start building for free