title: C# Formatting numbers with spaces delimiting thousands
body: <p>I'm trying to format a decimal with the following requirements:</p>
  
  <ul>
  <li>Thousands are separated by spaces " " </li>
  <li>Decimal point is delimited by a
  comma "," (this is achieved by using the appropriate culture, in this
  case Croatian)</li>
  <li>There are two digits after the decimal point.</li>
  </ul>
  
  <p>So far I got this:</p>
  
  <pre><code>String.Format(new CultureInfo("hr-HR"), "{0:# ##0.00}", input)
  </code></pre>
  
  <p>This works well if the number has 4 or more digits before the decimal point. For example the value <strong>5500.5</strong> gives me <strong>"5 500,50"</strong> and <strong>-5500.5</strong> gives me <strong>"-5 500,50"</strong>, which is what I want.</p>
  
  <p>But if the number has fewer digits, I get a white space in front of the number. For example <strong>500.5</strong> gives me <strong>" 500,50"</strong> instead of <strong>"500,50"</strong>. And with a negative number, the space is put between the minus sign and the digits: <strong>-500.5</strong> gives me <strong>"- 500,50"</strong>. So I can't simply trim the result. How can I achieve what I need?</p>