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

  • 相关阅读:
    DBA 职责及日常工作职责
    mysql 语句笔记
    学习Groovy — 闭包
    linux 命令: 网络和进程
    linux命令: rm命令
    Pro Git-- 跟踪分支
    Redis Tutorial
    linux 命令--文件操作
    分库分表的几种常见形式
    乐观锁与悲观锁
  • 原文地址:https://www.cnblogs.com/curtainy/p/4078104.html
Copyright © 2011-2022 走看看