# Format
<span class="source-link">[[Source]](src/format/format.md#L-0-37)</span>

Provides functions for generating formatted strings.

* fmt. Format to use.
* prefix. Prefix to use.
* prec. Precision to use. The exact meaning of this depends on the type,
but is generally the number of characters used for all, or part, of the
string. A value of -1 indicates that the default for the type should be
used.
* width. The minimum number of characters that will be in the produced
string. If necessary the string will be padded with the fill character to
make it long enough.
* align. Specify whether fill characters should be added at the beginning or
end of the generated string, or both.
* fill. The character to pad a string with if is is shorter than width.


```pony
primitive val Format
```

## Constructors

### create
<span class="source-link">[[Source]](src/format/format.md#L-0-37)</span>


```pony
new val create()
: Format val^
```

#### Returns

* [Format](format-Format.md) val^

---

## Public Functions

### apply
<span class="source-link">[[Source]](src/format/format.md#L-0-54)</span>


```pony
fun box apply(
  str: String val,
  fmt: FormatDefault val = reference,
  prefix: PrefixDefault val = reference,
  prec: USize val = call,
  width: USize val = 0,
  align: Align = reference,
  fill: U32 val = 32)
: String iso^
```
#### Parameters

*   str: [String](builtin-String.md) val
*   fmt: [FormatDefault](format-FormatDefault.md) val = reference
*   prefix: [PrefixDefault](format-PrefixDefault.md) val = reference
*   prec: [USize](builtin-USize.md) val = call
*   width: [USize](builtin-USize.md) val = 0
*   align: [Align](format-Align.md) = reference
*   fill: [U32](builtin-U32.md) val = 32

#### Returns

* [String](builtin-String.md) iso^

---

### int\[A: ([Int](builtin-Int.md) & [Integer](builtin-Integer.md)\[A\])\]
<span class="source-link">[[Source]](src/format/format.md#L-0-94)</span>


```pony
fun box int[A: (Int & Integer[A])](
  x: A,
  fmt: FormatInt = reference,
  prefix: PrefixNumber = reference,
  prec: USize val = call,
  width: USize val = 0,
  align: Align = reference,
  fill: U32 val = 32)
: String iso^
```
#### Parameters

*   x: A
*   fmt: [FormatInt](format-FormatInt.md) = reference
*   prefix: [PrefixNumber](format-PrefixNumber.md) = reference
*   prec: [USize](builtin-USize.md) val = call
*   width: [USize](builtin-USize.md) val = 0
*   align: [Align](format-Align.md) = reference
*   fill: [U32](builtin-U32.md) val = 32

#### Returns

* [String](builtin-String.md) iso^

---

### float\[A: ([Float](builtin-Float.md) & [FloatingPoint](builtin-FloatingPoint.md)\[A\])\]
<span class="source-link">[[Source]](src/format/format.md#L-0-135)</span>


```pony
fun box float[A: (Float & FloatingPoint[A])](
  x: A,
  fmt: FormatFloat = reference,
  prefix: PrefixNumber = reference,
  prec: USize val = 6,
  width: USize val = 0,
  align: Align = reference,
  fill: U32 val = 32)
: String iso^
```
#### Parameters

*   x: A
*   fmt: [FormatFloat](format-FormatFloat.md) = reference
*   prefix: [PrefixNumber](format-PrefixNumber.md) = reference
*   prec: [USize](builtin-USize.md) val = 6
*   width: [USize](builtin-USize.md) val = 0
*   align: [Align](format-Align.md) = reference
*   fill: [U32](builtin-U32.md) val = 32

#### Returns

* [String](builtin-String.md) iso^

---

### eq
<span class="source-link">[[Source]](src/format/format.md#L-0-54)</span>


```pony
fun box eq(
  that: Format val)
: Bool val
```
#### Parameters

*   that: [Format](format-Format.md) val

#### Returns

* [Bool](builtin-Bool.md) val

---

### ne
<span class="source-link">[[Source]](src/format/format.md#L-0-54)</span>


```pony
fun box ne(
  that: Format val)
: Bool val
```
#### Parameters

*   that: [Format](format-Format.md) val

#### Returns

* [Bool](builtin-Bool.md) val

---

