import java.text.DecimalFormat;
public class TestDecimalFormat{
public static void main(String[] args){
DecimalFormat df = new DecimalFormat();
df.applyPattern("##,####,####");
System.out.println(df.format(1234567890));
System.out.println(df.format(-1234567890));
}
}
public class TestDecimalFormat{
public static void main(String[] args){
DecimalFormat df = new DecimalFormat();
df.applyPattern("##,####,####");
System.out.println(df.format(1234567890));
System.out.println(df.format(-1234567890));
}
}
'函数名:comma
'作用:数据格式化
'**************************************************
function comma(str)
dim result,pos,loopcount,tempresult,dex,res,num
pos=instr(1,str,".")
if pos> 0 then
dex=mid(str,pos)
num=split(str,".")
res =strreverse(num(0))
if len(num(0))<4 then
result=str
end if
else
if len(str)<4 then
result=str
end if
res=strreverse(str)
end if
loopcount=1
while loopcount<=len(res)
tempresult=tempresult+mid(res,loopcount,3)
loopcount=loopcount+3
if loopcount<=len(res) then
tempresult=tempresult+","
end if
wend
result=strreverse(tempresult)+dex
comma=result
end function
java.text.DecimalFormat df = new java.text.DecimalFormat("#,###0.00");
return df.format(Double.parseDouble(s));
}
java.text.NumberFormat
是这样吗?
<input type="text" align=right>
不行的