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));
}
}

解决方案 »

  1.   

    '**************************************************
    '函数名: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
      

  2.   

    这个是asp的自己可以写个类似的jsp版本
      

  3.   

    public static String formatKiloDoulbe(String s) {
        java.text.DecimalFormat df = new java.text.DecimalFormat("#,###0.00");
        return df.format(Double.parseDouble(s));
    }
      

  4.   

    使用数字格式化类
    java.text.NumberFormat
      

  5.   

    to  javaororacle(走哪条路) :
    是这样吗?
    <input type="text" align=right>
    不行的