zoukankan      html  css  js  c++  java
  • 把字符串转换为Double 类型

     //把字符串转换为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;
            }  
       

  • 相关阅读:
    4Sum
    3Sum Closest
    3Sum
    Longest Common Prefix
    Roman to Integer
    thinkphp3.2自定义配置文件
    centos7下git的使用和配置
    git 报错
    Git服务器安装详解及安装遇到问题解决方案
    centos GIT安装
  • 原文地址:https://www.cnblogs.com/curtainy/p/4078104.html
Copyright © 2011-2022 走看看