首页 > 其他 > 详细

把字符串转换为Double 类型

时间:2014-11-06 12:21:44      阅读:309      评论:0      收藏:0      [点我收藏+]

 //把字符串转换为Double 类型
    public Double convertStringToDouble(String value){
           
           Double doubleValue = new Double("0.00");
           if(value != null && !"".equals(value))
              doubleValue = new Double(value.replaceAll(",",""));
              
           return doubleValue;
        }

 

  public Integer convertStringToInteger(String value){
           
           Integer intValue = new Integer("0");
           if(value != null && !"".equals(value))
              intValue = new Integer(value);
              
           return intValue;
        }
        
    //把字符串转换为Date类型    
    public Date convertStringToDate(String value){
        
          Date dateValue = null;
          
          if(value != null && !"".equals(value)){
            try{
            SimpleDateFormat   format = new SimpleDateFormat("yyyy-MM-dd");  
            dateValue = format.parse(value);
            }catch(Exception e){
                  log.error("convertStrngToDouble:日期转换错误!");
                  e.printStackTrace();
                }
            
            }
            
          return dateValue;
        }  
   

把字符串转换为Double 类型

原文:http://www.cnblogs.com/curtainy/p/4078104.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!