Getting the number of decimal places: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(added Arturo)
Line 114: Line 114:
1.23456789E+10 has 0 decimals
1.23456789E+10 has 0 decimals
</pre>
</pre>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">nofDecimals: function [n][
str: (string? n)? -> n -> to :string n
size last split.by:"." str
]

loop [12 12.345 "12.3450" 12.34567] 'n ->
print ["number of decimals of" n "->" nofDecimals n]</syntaxhighlight>

{{out}}

<pre>number of decimals of 12 -> 2
number of decimals of 12.345 -> 3
number of decimals of 12.3450 -> 4
number of decimals of 12.34567 -> 5</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==