numberToString
  • Dark
    Light
  • PDF

numberToString

  • Dark
    Light
  • PDF

numberToString Task Purpose

The numberToString task is used to convert a number to a string. Based on the optional radix parameter, the output returns a string that represents the specified number object. This task method is the opposite of the parseInt task used to convert a string value to a number. Lastly, the numberToString task does not change the value of the original number.

Note:

The radix specifies the number of unique digits in the numeral system, including 0. For example, a radix of 10 would represent the Decimal system because the Decimal system uses ten digits from 0 through 9. Whereas, a radix of 2 would represent the Binary system because the Binary system uses only two digits which are 0 and 1. A radix of 8 represents the Octal system, and a radix of 16 represents the Hexadecimal system.

Potential Use Cases

Sometimes you may need to construct a string that contains a number from another variable. You could potentially use this task to handle a field of numerical data that needs to be converted to a string first before exporting to a text file. Moreover, let's say you have implemented specific calculations and wish to display the computed numbers as text in a financial statement. To do this, you could use numberToString and convert the numbers to a string.

Properties

Input and output properties are shown below.

Input Type Description
num Number Required.
radix Number Optional. A number in the range of 2 through 36 specifying the mathematical base to use for representing a numeric value. If no radix is provided, the default will be 10 (a decimal number).


Output Type Description
numToString String A string representing the specified number object.

Example 1

In this IAP example, the incoming num variable is statically set to 255 and the radix number is omitted, so the default will be a decimal number (10).

numToString-01

The numToString value that returns in the outgoing variable is "255". Notice the number is a literal string enclosed within double quotation marks.

numToString-02

Example 2

In this IAP example, the radix of 2 represents the Binary system, which means the num variable of 255 will be converted to a Binary number.

numToString-03

The numToString value that returns is "11111111".

numToString-04

Example 3

With this example the radix of 8 represents the Octal system, which means the num variable of 255 will be converted to an Octal.

numToString-05

The numToString value that returns is "377".

numToString-06

Example 4

With this example the radix of 16 represents the Hexidecimal system, which means the num variable of 255 will be converted to a Hexidecimal number.

numToString-07

The numToString value that returns is "ff".

numToString-08


Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.