<?xml version="1.0"?>
<page id="Gimp.Unit.format_string"
      type="topic"
      style="function"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/1.0/ui/">
  <info>
    <link xref="Gimp.Unit" group="function" type="guide"/>
    <api:function>
      <api:returns>
        <api:type>String</api:type>
      </api:returns>
      <api:name>gimp_unit_format_string</api:name>
      <api:arg>
        <api:type>String</api:type>
        <api:name>format</api:name>
      </api:arg>
      <api:arg>
        <api:type>Gimp.Unit</api:type>
        <api:name>unit</api:name>
      </api:arg>
    </api:function>
  </info>
  <title>Gimp.Unit.format_string</title>
  <synopsis><code mime="text/x-gjs">
function format_string(format: String, unit: <link xref="Gimp.Unit">Gimp.Unit</link>): String {
    // Gjs wrapper for gimp_unit_format_string()
}
  </code></synopsis>
  <p>The <code>format</code> string supports the following percent expansions:</p>  <p>&lt;informaltable pgwide="1" frame="none" role="enum"&gt;
  &lt;tgroup cols="2"&gt;&lt;colspec colwidth="1*"/&gt;&lt;colspec colwidth="8*"/&gt;
    &lt;tbody&gt;
      &lt;row&gt;
        &lt;entry&gt;% f&lt;/entry&gt;
        &lt;entry&gt;Factor (how many units make up an inch)&lt;/entry&gt;
       &lt;/row&gt;
      &lt;row&gt;
        &lt;entry&gt;% y&lt;/entry&gt;
        &lt;entry&gt;Symbol (e.g. "''" for GIMP_UNIT_INCH)&lt;/entry&gt;
      &lt;/row&gt;
      &lt;row&gt;
        &lt;entry&gt;% a&lt;/entry&gt;
        &lt;entry&gt;Abbreviation&lt;/entry&gt;
      &lt;/row&gt;
      &lt;row&gt;
        &lt;entry&gt;% s&lt;/entry&gt;
        &lt;entry&gt;Singular&lt;/entry&gt;
      &lt;/row&gt;
      &lt;row&gt;
        &lt;entry&gt;% p&lt;/entry&gt;
        &lt;entry&gt;Plural&lt;/entry&gt;
      &lt;/row&gt;
      &lt;row&gt;
        &lt;entry&gt;%%&lt;/entry&gt;
        &lt;entry&gt;Literal percent&lt;/entry&gt;
      &lt;/row&gt;
    &lt;/tbody&gt;
  &lt;/tgroup&gt;
&lt;/informaltable&gt;</p>
  <p>Since 2.8</p>
<terms>
<item>
<title><code>format</code></title>
  <p>A printf-like format string which is used to create the unit
         string.</p>
</item>
<item>
<title><code>unit</code></title>
  <p>A unit.</p>
</item>
<item>
<title><code>Returns</code></title>
  <p>A newly allocated string with above percent expressions
         replaced with the resp. strings for <code>unit</code>.</p>
</item>
</terms>

</page>
