### Function

# Gimp Unit format_string

since: 2.8

#### Declaration [src]

    gchar*
    gimp_unit_format_string (
      const gchar* format,
      GimpUnit* unit
    )

#### Description [src]

The `format` string supports the following percent expansions:

- `%n`: Name (long label)
- `%a`: Abbreviation (short label)
- `%%`: Literal percent
- `%f`: Factor (how many units make up an inch)
- `%y`: Symbol (e.g. `''` for `GIMP_UNIT_INCH`).

Available since: 2.8

#### Parameters

`format`

  Type: `const gchar*`

  A printf-like format string which is used to create the unit string.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`unit`

  Type: `GimpUnit`

  A unit.

  The data is owned by the caller of the function.

#### Return value

Type: `gchar*`

A newly allocated string with above percent expressions replaced with the resp. strings for `unit`.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.