---
title: formatNumber
framework: TVMLKit JS
role: symbol
role_heading: Function
platforms: [tvOS 9.0+]
path: tvmljs/1627348-formatnumber
---

# formatNumber

Formats the specified number into the given format.

## Declaration

```data
String formatNumber(
    in int number, 
    in String styleValue, 
    in String positiveNumberFormat, 
    in String negativeNumberFormat
);
```

## Parameters

- `number`: An integer that is the number to be formatted.
- `styleValue`: A string that designates the style the number is formatted in to. Valid values are noStyle, currency, decimal, percent, scientific, spellOut. If no value is given for this parameter, it defaults to noStyle.
- `positiveNumberFormat`: The formatting used for a positive number value input.
- `negativeNumberFormat`: The formatting used for a negative number value input.

## Return Value

Return Value A string containing the formatted number.

## Discussion

Discussion This function changes an integer into a string, based on the formatting styles specified. For example, formatNumber(-60, “”, “+”, “-”) returns “-60”.

## See Also

### Formatting Information

- [formatDate](tvmljs/1627445-formatdate.md)
- [formatDuration](tvmljs/1627346-formatduration.md)
