copyraw
	
 
Use as per usual:
ValueWithCommas:=FormatAddCommas(NumberWithoutCommas)
- ValueWithCommas:=FormatAddCommas(NumberWithoutCommas)
copyraw
	
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:
copyraw
	
AddCommas(val)
	{
	  val:= RegExReplace(val, "(?(?
	- AddCommas(val)
- {
- val:= RegExReplace(val, "(?(?
Another not tested:
copyraw
	
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)
}
Category: AutoHotkey :: Article: 383
	

 
						  
                 
						  
                 
						  
                 
						  
                 
						  
                 
 
 

 
 
Add comment