Getting the number of decimal places: Difference between revisions

Content added Content deleted
(Added Sidef)
(Added 11l)
Line 11:
(Note that the reference implementation – in the '''Ring''' language – shows a function over a given '''number''' rather than a given numeric string, and that the sample values shown above are not enclosed in quotes).
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F dec(n)
R I ‘.’ C n {n.split(‘.’).last.len} E 0
 
print(dec(‘12.345’))
print(dec(‘12.3450’))</lang>
 
{{out}}
<pre>
3
4
</pre>
 
=={{header|AutoHotkey}}==
Line 23 ⟶ 38:
12.3450 has 4 decimals.
12.3450 has 4 decimals.</pre>
 
=={{header|AWK}}==
<lang AWK>