Format string number as currency
<p>I would like a mask function to format number (as string) like a lot of mask plugins do.</p>

<p>Desired behavior:</p>

<pre><code>format('1') // '0,01'
format('12') // '0,12'
format('123') // '1,23'
format('12345678') // '123.456,78'
</code></pre>

<p>It would be better if the formatter achieve this using only regex functions.</p>

<p><strong>[EDIT]</strong></p>

<p>A searched a lot of questions here in stackoverflow but mostly answers consist in add two decimal cases at the end of string. That's not what I expected.</p>

<p>EXPECTED: </p>

<pre><code>format('1') // '0,01'
format('123') // '1,23'
</code></pre>

<p>NOT EXPECTED:</p>

<pre><code>format('1') // '1,00'
format('123') // '123,00'
</code></pre>