Garry's Mod Wiki

string.Comma

  string string.Comma( number value, string separator = "," )

Description

Inserts commas for every third digit of a given number.

Arguments

1 number value
The input number to commafy
2 string separator = ","
An optional string that will be used instead of the default comma.

Returns

1 string
The commafied string

Example

Demonstrates the use of string.Comma

print( string.Comma( 123456789 ) )
Output:
123,456,789

Example

Demonstrates the use of the 2nd argument (separator)

print( "$" .. string.Comma( 987654321, "." ) )
Output:
$987.654.321