Numeric separator syntax: Difference between revisions

m (→‎{{header|Sidef}}: added zkl header)
(→‎{{header|zkl}}: added text)
Line 312:
 
=={{header|zkl}}==
<lang zkl>For source code, integers and floats allow a "_" between digits (or trailing)
<lang zkl></lang>
and completely ignores them:
<lang zkl></lang>
1_000 == 1_000_ == 1_0_0_0 == 1__________000
{{out}}
1_2.3_4 == 12.34
<pre>
For hex, both "_" and "|" are allowed: 0x12|34</lang>
 
<lang zkl>For printing, the String.fmt method will add separators for %d (interger: ","),
</pre>
%f (float: ","), %x (hex: "|") and %2B (binary: "|").
"%,d %,.0f %,x %,.2B".fmt(1234, 1234.0, 0x1234, 0x1234).println();
--> "1,234 1,234 12|34 1|0010|0011|0100"
Each objects toString method has optional parameters to specify a separator
and "column width". This method is called (by fmt) for the above tags.</lang>
Anonymous user