Revision Difference
string.Comma#548756
<function name="Comma" parent="string" type="libraryfunc">
<description>Inserts commas for every third digit of a given number.</description>
<realm>Shared and Menu</realm>
<file line="354">lua/includes/extensions/string.lua</file>
<args>
<arg name="value" type="number">The input number to commafy</arg>
<arg name="separator" type="string">An optional string that will be used instead of the default comma. If the value is not specified, the character ',' will be used.</arg>
<arg name="separator" type="string" default=",">An optional string that will be used instead of the default comma.</arg>
</args>
<rets>
<ret name="" type="string">The commafied string</ret>
</rets>
</function>
<example>
<description>Demonstrates the use of string.Comma</description>
<output>123,456,789</output>⤶
<code>MsgN(string.Comma(123456789))</code>⤶
<code>print( string.Comma( 123456789 ) )</code>⤶
<output>⤶
```⤶
123,456,789⤶
```⤶
</output>⤶
</example>
⤶
⤶
<example>⤶
⤶
<example>⤶
<description>Demonstrates the use of the 2nd argument (separator)</description>
<output>$987.654.321</output>⤶
<code>print( "$"..string.Comma(987654321, ".") )</code>⤶
<code>print( "$" .. string.Comma( 987654321, "." ) )</code>⤶
<output>⤶
```⤶
$987.654.321⤶
```⤶
</output>⤶
</example>