Code example for ParsePosition

Methods: getErrorIndex

0
			srcFormat = "yyyyMMddhhmmss";
		} 
		 
		String targetFormat = (isLongFormat) ? "yyyy/MM/dd(hh:mm)" : "yy/MM/dd";
		SimpleDateFormat format = new SimpleDateFormat(srcFormat);
		ParsePosition pos = new ParsePosition(0);
		Date date = format.parse(strDate, pos);
		if(pos.getErrorIndex() > -1) {
			return strDate + ":Format Error=" + pos;
		} 
		 
		return new SimpleDateFormat(targetFormat).format(date);
	} 
	 
	 
	/** 
	 * string에 특수문자가 들어있으면 true를 리턴한다. 
	 * =>  ? \ / : * " < > | 
	 * @param str 
	 * @return 
	 */