⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 changefield.java

📁 jsp考勤
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		cal.setLenient(false);

		try {
			cal.setTime(datdate);

			// 擭寧擔偺庢摼
			strdate[1] = Integer.toString(cal.get(Calendar.HOUR_OF_DAY));
			strdate[2] = Integer.toString(cal.get(Calendar.MINUTE));
			strdate[3] = Integer.toString(cal.get(Calendar.SECOND));
			strdate[0] = strdate[1] + ":" + strdate[2] + ":" + strdate[3];

			return strdate;

		} catch (NumberFormatException ne) {
			throw new ApplicationException(ne, fieldname);
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	public String insKmma(String val, int len) {
		try {
			DecimalFormat df = new DecimalFormat();
			String form = "";
			int i = 0;
			for (int j = 0; j < len; j++) {

				if (i == 3) {
					form = "#," + form;
					i = 0;
				} else {
					form = "#" + form;
				}
				i = i + 1;
			}
			df.applyPattern(form);
			double doubleval = Double.parseDouble(val);
			String st = df.format(doubleval);
			return st;

		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	public String delKmma(String val) {
		try {
			String form_val = "";
			if (val != null && val.length() > 0) {

				for (int j = 0; j < val.length(); j++) {

					if (val.substring(j, j + 1).equals(",")) {
					} else {
						form_val = form_val + val.substring(j, j + 1);
					}
				}
			} else {
				if (val == null || val.equals("")) {
					form_val = null;
				} else {
					form_val = "0";
				}

			}
			return form_val;

		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	public String delSura(String val) {
		try {
			String form_val = "";
			if (val != null && val.length() > 0) {

				for (int j = 0; j < val.length(); j++) {

					if (val.substring(j, j + 1).equals("/")) {
					} else {
						form_val = form_val + val.substring(j, j + 1);
					}
				}
			} else {
				if (val == null || val.equals("")) {
					form_val = null;
				} else {
					form_val = "0";
				}

			}
			return form_val;

		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}
	/**
	 *	僇儞儅捛壛張棟
	 *
	 *	@param	number		張棟偡傞抣
	 *          following   
	 *			point		彫悢揰偑偁傞偐側偄偐抣
	 */

	public String insertKannma(String number, String following, String point) {
		try {

			if (number == null || number.equals(""))
				return number;
			// 妋幚偵暥帤楍宆偵曄姺偡傞丅
			String s = "" + number;
			// 彫悢揰帺摦捛壛僼儔僌
			String follFlag = "false";
			String follFlag1 = "false";

			// 彫悢揰偺埵抲傪0僆儕僕儞偱媮傔傞
			int p = s.indexOf(".");

			String s1 = "";
			if (p > 0) {
				s1 = s.substring(p + 1, s.length());
			}

			if (p < 0) {
				p = s.length();
				if (following != "") {
					follFlag = "true";
				}
			} else if (s1.length() == 1) {
				follFlag1 = "true";
			}

			String r = s.substring(p, s.length());

			for (int i = 0; i < p; i++) {
				// (10 ^ i) 偺埵偺傂偲偮偺寘偺悢帤丅
				String c = s.substring(p - 1 - i, p - 1 - i + 1);
				// 3 寘偛偲丄偨偩偟弶夞偼彍偔丅
				if (i > 0 && i % 3 == 0) {
					r = "," + r;
				}
				r = c + r;
			}
			if (follFlag == "true") {
				// 彫悢揰偑側偄応崌
				r = r + following;

			} else if (follFlag1 == "true") {
				r = r + "0";
			}
			number = r;
			// point yes/no 
			// insert by ssm 
			if (point == "no") {
				int jlen = number.indexOf('.');
				if (jlen > 0)
					number = number.substring(0, jlen);
			}
			return number;
		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}
	/**
	 *	僇儞儅嶍彍張棟
	 *
	 *	@param	numstr			僇儞儅傪嶍彍偟偨偄曄姺
	 */
	public String delKannma(String numstr) {
		try {

			String temp = "";

			if (numstr == null || numstr.length() < 1)
				return temp;

			//var temp = inputObj;
			temp = numstr;
			int i = 0;
			while (temp.indexOf(',', i) != -1) {
				i = temp.indexOf(',', i);
				temp =
					""
						+ temp.substring(0, i)
						+ temp.substring(i + 1, temp.length());
			}
			return temp;
		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	/**
	 * 擔晅宆僼僅乕儅僢僩儊僜僢僪
	 * @param			Object 曄姺尦僨乕僞
	 * @param			String 僼僅乕儅僢僩僷僞乕儞(SimpleDateFormat偺巇條偵弨嫆)
	 * @return			Object 曄姺屻僨乕僞
	 */
	public Object changeDate(Object date, String format) {
		SimpleDateFormat sdf;
		//栠傝抣
		Object obj = date;
		//暥帤曄姺屻偺抣
		try {
			if (date == null || date.equals("")) {
				obj = "";
			} else if (format != null && !format.equals("")) {
				//僼僅乕儅僢僩偺愝掕
				sdf = new SimpleDateFormat(format);

				//曄姺偡傞
				obj = (Object) sdf.format(date);
			}

			//栠傝抣:曄姺偟偨抣
			return obj;

		} catch (IllegalArgumentException ie) {
			ie.printStackTrace();
			throw new ApplicationException((String) date);
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	/**
	 *	僇儞儅捛壛張棟
	 *
	 *	@param	number		張棟偡傞抣
	 *	@param	num			彫悢埲壓偺寘悢
	 */

	public String insertKannma(String number, int num) {
		try {
			DecimalFormat df = new DecimalFormat();
			String form = "###,###,###,##0";
			String str = "";
			if (num > 0){
				str = ".";
				for (int i=0; i<num; i++){
					str = str + "0";
				}
			}
			form = form + str;
			
			double dou = Double.parseDouble(number);

			df.applyPattern(form);

			String st = df.format(dou);
			return st;

		} catch (NumberFormatException ne) {
			ne.printStackTrace();
			throw new ApplicationException("");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	/**
	*	攝楍宆曄姺(Object[][] 仺 String[][])<br>Object2師尦攝楍傪String2師尦攝楍傊曄姺偟傑偡丅
	*	@param  obj     曄姺尦攝楍
	*	return	dsp		曄姺屻攝楍
	*/
	public String[][] objArrayToStrArray2(Object[][] obj) {

		String[][] dsp = null;
		try {

			if(obj == null || obj.length == 0){
				dsp = new String[1][2];
				dsp[0][0] = "";
				dsp[0][1] = "";
			}else{
				dsp = new String[obj.length][obj[0].length];
				for (int i=0; i<obj.length; i++){
					for (int ii=0; ii<obj[0].length; ii++){
						dsp[i][ii] = String.valueOf(obj[i][ii]);
					}
				}
			}
			return dsp;

		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	/**
	 * null傪巜掕偺抣偵抲偒姺偊傑偡丅(Object宆)
	 * @param			Object 曄姺尦僨乕僞
	 * @param			String 曄姺屻僨乕僞
	 * @return			Object 曄姺屻僨乕僞
	 */
	public Object nvl(Object t_data,String r_data)
	{
		//栠傝抣
		Object obj = t_data;

		try{
			if(r_data == null){
				throw new ApplicationException("");
			}
			if(obj == null){
				obj = (Object)r_data;
			}

			//栠傝抣:曄姺偟偨抣
			return obj;

		} catch (ApplicationException ae) {
			ae.printStackTrace();
			throw new ApplicationException("null傊偺抲姺偼弌棃傑偣傫丅");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}

	/**
	 * null傪巜掕偺抣偵抲偒姺偊傑偡丅(String宆)
	 * @param			String 曄姺尦僨乕僞
	 * @param			String 曄姺屻僨乕僞
	 * @return			String 曄姺屻僨乕僞
	 */
	public String nvl(String t_data,String r_data)
	{
		//栠傝抣
		String obj = t_data;

		try{
			if(r_data == null){
				throw new ApplicationException("");
			}
			if(obj == null){
				obj = (String)r_data;
			}

			//栠傝抣:曄姺偟偨抣
			return obj;

		} catch (ApplicationException ae) {
			ae.printStackTrace();
			throw new ApplicationException("null傊偺抲姺偼弌棃傑偣傫丅");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}
	/**
	 * @param			String	懼姺帉僨乕僞
	 * @return			List	懼姺帉List
	 */
	public List cha_change_word(String stringed_change)
	{
		//栠傝抣
		List list_change_word = new ArrayList();

		try{
			String  chang_fg_s	=	"<#";
			String  chang_fg_e	=	"#>";
			String _chang_fg_s	=	"";
			String _chang_fg_e	=	"";
			if (stringed_change == null || stringed_change.length() < 1)
				return list_change_word;
			int	index	=	1;
			int	i_s		=	0;
			int	i_s_p		=	0;
			_chang_fg_s	=	chang_fg_s	+	Integer.toString(index);
			_chang_fg_e	=	Integer.toString(index)	+	chang_fg_e;
			for (int i=0; i<stringed_change.length() - 3; i++){
				i_s_p	=	i	+	3;
				if(stringed_change.substring(i,i_s_p).equals(_chang_fg_s)){
					i_s		=	i;
				}
				if(stringed_change.substring(i,i_s_p).equals(_chang_fg_e)){
					list_change_word.add(stringed_change.substring(i_s+3,i));
					index	=	index	+	1;
					_chang_fg_s	=	chang_fg_s	+	Integer.toString(index);
					_chang_fg_e	=	Integer.toString(index)	+	chang_fg_e;
				}
			}
			//栠傝抣:曄姺偟偨抣
			return list_change_word;

		} catch (ApplicationException ae) {
			ae.printStackTrace();
			throw new ApplicationException("抲姺偼弌棃傑偣傫丅");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}
	/**
	 * @param			String	懼姺帉僨乕僞
	 * @return			List	懼姺帉List
	 */
	public String str_change(List list_change,String string_changed)
	{
		//栠傝抣
		String  changed_str = string_changed;
		String _changed_str = "";

		try{
			String  chang_fg_s	=	"<#";
			String  chang_fg_e	=	"#>";
			String _chang_fg_s	=	"";
			String _chang_fg_e	=	"";
			int		len_str		=	0;
			int		i_s_p		=	0;
			if (string_changed == null || string_changed.length() < 1)
				return string_changed;
			int	index	=	1;
			int	i_s		=	0;
			String	_list_change	=	"";
			String	change_fg		=	"";
			_chang_fg_s	=	chang_fg_s	+	Integer.toString(index);
			_chang_fg_e	=	Integer.toString(index)	+	chang_fg_e;
			for (int j=0; j<list_change.size(); j++){
				_chang_fg_s	=	chang_fg_s	+	Integer.toString(j+1);
				_chang_fg_e	=	Integer.toString(j+1)	+	chang_fg_e;
				_list_change	=	(String)list_change.get(j);
				len_str			=	changed_str.length();
				_changed_str	=	"";
				change_fg	=	"N";
				for (int i=0; i<len_str - 3; i++){
					i_s_p	=	i	+	3;
					index	=	i	+	1;
					if(changed_str.substring(i,i_s_p).equals(_chang_fg_s)){
						i_s		=	i;
					}
					if(changed_str.substring(i,i_s_p).equals(_chang_fg_e)){
						_changed_str	=	_changed_str	+	changed_str.substring(0,i_s);
						_changed_str	=	_changed_str	+	_list_change;
						_changed_str	=	_changed_str	+	changed_str.substring(i_s_p,len_str);
						change_fg	=	"Y";
						break;
					}
				}
				if(change_fg.equals("Y")){
					changed_str		=	_changed_str;
					j	=	j	-	1;
				}
			}
			//栠傝抣:曄姺偟偨抣
			return changed_str;

		} catch (ApplicationException ae) {
			ae.printStackTrace();
			throw new ApplicationException("抲姺偼弌棃傑偣傫丅");
		} catch (Exception e) {
			throw new OriginalException(e);
		} finally {
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -