ThousandsSep()

Author: infogulch Last Modified: 20100304


Here is a simple one-liner regex/function that add thousands separators to the correct spots in any decimal number with no loops, no recursion, and no callouts.

ThousandsSep(x, s=",")

For more details of the functions's parameters and return value, please see it's source code.

Remarks

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/topic54149.html

License

The functions is an open source item under the infogulch`s license license. For details, please see infogulch-license.txt

Example

; #Include ThousandsSep.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

MsgBox %  ThousandsSep(1)
   . "`n" ThousandsSep(12)
   . "`n" ThousandsSep(1234)
   . "`n" ThousandsSep(1234567890)
   . "`n`n" ThousandsSep(1.1)
   . "`n" ThousandsSep(12.12)
   . "`n" ThousandsSep(123.123)
   . "`n" ThousandsSep(1234.1234)
   . "`n" ThousandsSep(1234567890.1234567890)