<%
'*********************************
'Function: comma(str)
'Parameter: str, the number to be processed
'Author: Alixi
'Date: 2007/7/12
'Description: Returns the value formatted in the display of numerical numbers in the thousandths
'Example: <%=comma("120300")%>
'*********************************
functioncomma(str)
ifnot(isnumeric(str))orstr=0then
result=0
elseiflen(fix(str))<4then
result=str
else
pos=instr(1,str,".")
ifpos>0then
dec=mid(str,pos)
endif
res=strreverse(fix(str))
loopcount=1
whileloopcount<=len(res)
tempresult=tempresult+mid(res,loopcount,3)
loopcount=loopcount+3
ifloopcount<=len(res)then
tempresult=tempresult+","
endif
wend
result=strreverse(tempresult)+dec
endif
comma=result
endfunction
%>