To locale number action

The To locale number action in the String package enables you to convert a string to a locale-formatted number.

Settings

  • In the Source value field, specify the source string.
  • Select any of the following tab to specify locale:
    • Specify: Manually specify the two letter ISO codes for the locale you want to use in the Locale field.
    • Device: Use the default locale configured for the device.
  • In the Save the outcome to a variable list, specify the variable.

You can also use the action in an expression. For example, $prompt-assignment.String:toLocaleNumber("en-US")$.

Example

Create a sample bot and perform the following steps to convert a string to a locale-formatted number:
  1. Create a bot.
    1. On the left panel, click Automation.

      A list of available bots and forms is displayed.

    2. Click Create a bot.
    3. Enter the bot name: String_localenumber.
    4. Click Create and Edit.
  2. To convert a string to a locale-formatted number, from the Actions pane, double-click or drag the String > To locale number action.
    1. In the Source value field, enter 1,23,345.67
    2. Select the Specify option and enter en-US in the Locale field.
    3. In the Save the outcome to a variable field, click the Create variable icon to create a variable.
    4. On the Create variable window, enter Num_output in the Name field.
  3. To convert the number to a string, from the Actions pane, double-click or drag the Number > To string action.
    1. In the Enter a number field, select $Num_output$ variable.
    2. In the Enter number of digits after decimal (number format) field, enter 2.
    3. In the Assign the output to variable field, click the Create variable icon to create a variable.
    4. On the Create variable window, enter locale_output in the Name field.
    5. Click Create and select.
  4. To print the values, double-click or drag the Message box action. In the Enter the message to display field, enter $locale_output$.
  5. Click Save and then Run.

    The bot now displays the value as 123345.67

    Convert a string to a locale formatted number