# ntos

## ntos(source, format)

Returns number as a string

## Arguments

Argument | Data Type | Description
source | number | Number to be converted
format | string | A string which defines the format of the string to produce

## Returns

A string in the required format

## Description

Converts a number to a string using the supplied format. Can generate different formats for positive and negative numbers. See Number Formatting for detailed explanation of the patterns used.

The str() function also converts a number to a string, but is restricted in the formats it can produce.

## Examples

For clarity, the examples all show a number as the source - you can of course use a Field ID to get the contents of a field instead.

Example | Returns | Description
ntos(123, "0") | "123" | Simplest possible format - just gives you the number
ntos(1234, "#,##0" | "1,234" | Add a grouping seperator
ntos(1234567, "#,##0") | "1,234,567" | Only need to define the grouping separator once
ntos(-123, "0") | "-123" | By default, the format for negative numbers is the same as positive numbers with "-" in front
ntos(-123, "0;(0)") | "(123)" | We can specify a completely different format for negative numbers
ntos(123, "$0.00") | "$123.00" | We can specify text in the format
ntos(-1234, "$ #,##0.00;-$ #,##0.00") | "-$ 1,234.00 | Quite complex formatting is possible

## See Also

ston(), str(), val(), Number Formatting