### Function

# Gimp Unit format_string

#### Declaration [src]

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

#### Description [src]

The `format` string supports the following percent expansions:

<row> <entry>% f</entry> <entry>Factor (how many units make up an inch)</entry> </row> <row> <entry>% y</entry> <entry>Symbol (e.g. “”” for GIMP_UNIT_INCH)</entry> </row> <row> <entry>% a</entry> <entry>Abbreviation</entry> </row> <row> <entry>% s</entry> <entry>Singular</entry> </row> <row> <entry>% p</entry> <entry>Plural</entry> </row> <row> <entry>%%</entry> <entry>Literal percent</entry> </row>

Available since: | 2.8

#### Parameters

`format` | `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` | `GimpUnit`
| A unit.

#### Return value

Returns: | `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.