Getting the number of decimal places: Difference between revisions
Content added Content deleted
(Added Sidef) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 11: | 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). |
(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> |
<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}}== |
=={{header|AutoHotkey}}== |
||
Line 23: | Line 38: | ||
12.3450 has 4 decimals. |
12.3450 has 4 decimals. |
||
12.3450 has 4 decimals.</pre> |
12.3450 has 4 decimals.</pre> |
||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
<lang AWK> |
<lang AWK> |