title: Format string for printf hacking
body: <p>This is hacking for a useful (non-malicious) purpose and I'm not sure what I want can be done but I'd like to try. I'm running software that is closed source so I can't modify the original function call. The call is:</p>
  
  <pre><code>sprintf(string, this-&gt;LabelFormat, value)
  </code></pre>
  
  <p>And <code>this-&gt;LabelFormat</code> is <code>%-#6.3g</code> by default. The purpose is to format labels for a legend of doubles, so <code>value</code> is a number. </p>
  
  <p>I can set <code>this-&gt;LabelFormat</code> to whatever I want. I would like to perform a mapping from numbers to strings, for example:</p>
  
  <pre><code>value | string
  --------------
    0.0 | None
    1.0 | I
    2.0 | J
    3.0 | K
  </code></pre>
  
  <p>and so on. <strong>Is it at all possible to manipulate the format string to perform a specified mapping for me since I cannot modify the original code?</strong></p>