ValueWithCommas:=FormatAddCommas(NumberWithoutCommas)
- ValueWithCommas:=FormatAddCommas(NumberWithoutCommas)
AddCommas(val) { val:= RegExReplace(val, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,") Return val }
- AddCommas(val)
- {
- val:= RegExReplace(val, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
- Return val
- }
One taken from the AutoHotkey forums:
AddCommas(val) { val:= RegExReplace(val, "(?(?
- AddCommas(val)
- {
- val:= RegExReplace(val, "(?(?
Another not tested:
CommaAdd(num) { VarSetCapacity(fNum,32) DllCall("GetNumberFormat",UInt,0x0409,UInt,0,Str,Num,UInt,0,Str,fNum,Int,32) return SubStr(fNum,1,StrLen(fNum) - 3) }
- CommaAdd(num) {
- VarSetCapacity(fNum,32)
- DllCall("GetNumberFormat",UInt,0x0409,UInt,0,Str,Num,UInt,0,Str,fNum,Int,32)
- return SubStr(fNum,1,StrLen(fNum) - 3)
- }
And finally PhiLho's:
CommaAdd(num) { VarSetCapacity(fNum,32) DllCall("GetNumberFormat",UInt,0x0409,UInt,0,Str,Num,UInt,0,Str,fNum,Int,32) return SubStr(fNum,1,StrLen(fNum) - 3) }