欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
類(lèi)型轉換類(lèi),將字符串轉換成其他基本類(lèi)型
/***************************************
 *                                     *
 *  MCC: 客服系統                        *
 *                                     *
 *  所有版權(c) 上海若雅信息系統有限公司     *
 *                                     *
 ***************************************/
package com.roya.mcc.util;
import java.util.*;
import com.roya.mcc.core.exception.TypeConvertException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
/**
 * 類(lèi)型轉換類(lèi),將字符串轉換成其他基本類(lèi)型
 *
 * @version <tt>Revision: 1.0</tt>
 * @author  <a href="mailto:hulk@royasoft.com.cn">hongking</a>
 */
public class TypeConvertor {
 public static Integer string2Integer(String str) throws TypeConvertException{
  int value = -1;
  try{
   value = Integer.parseInt(str);
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return new Integer(value);
 }
 
 public static Long string2Long(String str) throws TypeConvertException{
  long value = -1;
  try{
   value = Long.parseLong(str);
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return new Long(value);
 }
 
 public static Float string2Float(String str) throws TypeConvertException{
  float value = 0;
  try{
   value = Float.parseFloat(str);
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return new Float(value);
 }
 
 public static Date string2Date(String str,String format)  throws TypeConvertException{
  Date dt = null;
  try{
   if(format == null || "".equals(format)){
    DateFormat Format = DateFormat.getDateInstance();
    dt = Format.parse(str);
   }
   else{
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    dt = sdf.parse(str);
   }
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return dt;
 }
 
 public static Date string2Time(String str,String format)  throws TypeConvertException{
  Date dt = null;
  try{
   if(format == null || "".equals(format)){
    DateFormat Format = DateFormat.getTimeInstance();
    dt = Format.parse(str);
   }
   else{
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    dt = sdf.parse(str);
   }
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return dt;
 }
 public static Date string2DateTime(String str,String format)  throws TypeConvertException{
  Date dt = null;
  try{
   if(format == null || "".equals(format)){
    DateFormat Format = DateFormat.getDateTimeInstance();
    dt = Format.parse(str);
   }
   else{
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    dt = sdf.parse(str);
   }
  }
  catch(Exception e){
   throw new TypeConvertException(e);
  }
  return dt;
 }
 
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
String 轉換 java.sql.Date 和java.sql.Time 格式
java.text.SimpleDateFormat.parse() 是 no thread safe
深入理解Java:SimpleDateFormat安全的時(shí)間格式化
使用SimpleDateFormat順利解析日期
java String和Date轉換
一個(gè)Java日期格式驗證的歷程
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久