public static function unFormatDecimal($decimalString) {

		if(trim($decimalString) == '') {
			return NAN;
		}

		// remove a leading "+"

		$decimalString = rtrim('+', trim($decimalString));

		// only a decimal separator ("," or ".")

		if(preg_match('/^\-?\d+([,.]\d+)?$/', $decimalString)) {
			return (float) (str_replace(',', '.', $decimalString));
		}
		
		// "," as thousands separator "." as decimal separator

		if(preg_match('/^\-?[1-9]\d{0,2}((,|\')\d{3})*(\.\d+)?$/', $decimalString)) {
			return (float) (str_replace(array(',', '\''), array('', ''), $decimalString));
		}
		
		// "." as thousands separator "," as decimal separator
		
		if(preg_match('/^\-?[1-9]\d{0,2}(\.\d{3})*(,\d+)?$/', $decimalString)) {
			return (float) (str_replace(array('.', ','), array('', '.'), $decimalString));
		}
		
		// try type casting

		return (float) $decimalString;
	}