Sign Up

Conversion

Overview

Twidget's conversion commands allow you to easily convert different data types to the required format. Below is a list of the available conversion commands and examples of how to use them.

1. Convert to Text

The Convert to Text command converts the provided value to a text (string) format.

Examples:

  • 123 converts to "123"

  • true converts to "true"

  • [1, 2, 3] converts to "[1, 2, 3]"

  • {"name": "John"} converts to "{\"name\": \"John\"}"

2. Convert to Number

The Convert to Number command converts the provided value to a numerical format.

Examples:

  • "123" converts to 123

  • true converts to 1

  • false converts to 0

  • "12.34" converts to 12.34

3. Convert to Boolean

The Convert to Boolean command converts the provided value to a boolean (true/false) format.

Examples:

  • "true" converts to true

  • "false" converts to false

  • 1 converts to true

  • 0 converts to false

  • "" converts to false

  • "text" converts to true

4. Convert to Date

The Convert to Date command converts the provided value to a date format.

Examples:

  • "2021-12-31" converts to Fri Dec 31 2021

  • "12/31/2021" converts to Fri Dec 31 2021

  • 1633039200000 (timestamp) converts to Fri Oct 01 2021

5. Convert to Object

The Convert to Object command converts the provided value to an object format.

Examples:

  • '{"name": "John"}' converts to {"name": "John"}

  • '["1", "2", "3"]' converts to ["1", "2", "3"]

  • Any valid JSON string converts to its corresponding object

By utilizing these conversion commands, you can seamlessly transform data types to suit your specific requirements within Twidget.

Related Topics

Text

Twidget offers a variety of commands to manipulate text in various ways. To Uppercase. Converts all characters of the provided text to uppercase. - text: The text to be converted to uppercase. - A text string with all characters in uppercase. To Lowercase. Converts all characters of the provided tex...

Date

Twidget offers a variety of commands to manipulate date objects. Below are the available commands along with their respective descriptions, inputs, and outputs. Current Date. Description: Returns the current date and time. Output: - Type: DATE Add Time. Description: Returns the date plus a specified...

Math

Twidget offers a variety of commands to manipulate numbers. Below are the math commands available, along with their descriptions, inputs, and outputs. Sum. Description: Adds together a list of numbers and returns the sum. - Inputs: - `numbers`: A list of numbers to be added together. - Output: A sin...

Return

The `return` command in Twidget is a special command used to halt the current command workflow and immediately return a specified result. This command overrides any subsequent processes and outputs the return result regardless of the rest of the workflow logic. This command is particularly useful fo...

Loops

In Twidget, loops allow you to execute commands multiple times, either based on a condition or through a set number of iterations. Loops can also be nested, meaning you can run loops within other loops, creating complex logic for your tasks. List Loop. The `List Loop` command enables you to loop thr...