# Formatting

Fixed allows you to  format numbers to strings.

The following format characters are supported:

```
# - print a digit if present
0 - print a digit if present else 0. Used to pad strings with zeros.
. - print a dot. The invertSeparator parameter controls if this is treated 
       as a decimal place or a group separator.
, - print a comma. The invertSeparator parameter controls if this is treated 
       as a decimal place or a group separator.       
```

Internationally the '.' and ','  characters are used differently.&#x20;

### USA, UK, Australia etc

In countries such as the USA, UK and Australia the '.' (dot) is used as the delimiter between integer and decimal parts of a number whilst the ',' (comma) is used to group thousands.

Eleven Hundred dollars and 22 cents.

```
$1,100.22
```

In Europe and other countries the '.' (dot) and ',' (comma) are reversed:

### Europian countries etc

Eleven Hundred dollars and 22 cents.

```
$1.100,22
```

### Inverting separators

When formating a number you use the 'invertSeparator' argument to control who the separators character are used. By default, the USA, UK and Australia method is used. Pass invertSperator: false to use the European variation.

Example 4

```dart
var t3 = Fixed.fromInt(1234, scale: 3); // == 1.234

t3.format('00.###0'); // == '01.2340'

// format using euro separators
t3.format('00,###0', invertSeparator: true);  // == '01,2340'

var euFormat = Fixed.parse('1.000.000,23', invertSeparator: true, scale: 2);
// Format using a locale
euFormat.formatIntl('en-AUS'); // == '1,000,000.23'

// Format using default locale
euFormat.formatIntl(); // '1,000,000.23'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fixed.onepub.dev/formatting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
