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

  • 相关阅读:
    什么是Portal!
    Maven 让事情变得简单
    HTTP协议详解
    函数实现不放在头文件的原因,及何时可以放头文件的情况
    Linux中的内存管理(四)Heap
    寿星万年历Lua实现
    TCP epoll触发后只accept一次带来的问题
    生产者消费者问题
    Windows SDK 实现不规则窗口
    论迭代式的产品开发方法
  • 原文地址:https://www.cnblogs.com/curtainy/p/4078104.html
Copyright © 2011-2022 走看看