Code example for ParsePosition

Methods: getErrorIndex

0
		if( str == null || str.trim().length() == 0) return "";
 
		String srcFormat = "yyyyMMddhhmmss";
		String targetFormat = "yyyy.MM.dd HH시 mm분 ss초";
		SimpleDateFormat format = new SimpleDateFormat(srcFormat);
		ParsePosition pos = new ParsePosition(0);
		Date date = format.parse(str, pos);
		if(pos.getErrorIndex() > -1) {
			return str + ":Format Error=" + pos;
		} 
		 
		String strResult = new SimpleDateFormat(targetFormat).format(date);
		Log.d(TAG, "strResult : "+strResult);
		return strResult;
	} 
	 
	// "년","월"로 바꾸기 
	public String changeDateFormat(String str)
	{ 
		Log.d(TAG, "changeDateFormat");