Garry's Mod Wiki

Revision Difference

string.Comma#548753

<function name="Comma" parent="string" type="libraryfunc"> <description>Inserts commas for every third digit.</description> <description>Inserts commas for every third digit of a given number.</description> <realm>Shared and Menu</realm> <file line="335">lua/includes/extensions/string.lua</file> <file line="354">lua/includes/extensions/string.lua</file> <args> <arg name="InputNumber" type="number">The input number to commafy</arg> <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>⤶ </args> <rets> <ret name="" type="string">Prettystring</ret>⤶ <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> ⤶ </example></example>⤶ ⤶ ⤶ <example>⤶ <description>Demonstrates the use of the 2nd argument (separator)</description>⤶ <output>$987.654.321</output>⤶ <code>print( "$"..string.Comma(987654321, ".") )</code>⤶ </example>