title: Count number of decimal places in a Float (or Decimal) in Swift
body: <p>I want to count the number of decimal places (ignoring trailing zeros) in a Float (or NSDecimalNumber) for example:</p>
  
  <pre><code>1.45000 =&gt; 2
  5.98 =&gt; 2
  1.00 =&gt; 0
  0.857 =&gt; 3
  5 =&gt; 0
  </code></pre>
  
  <p>How can I accomplish this?</p>