/**
* Finds the first occurrence of ' ', '-', ',' or '.'
*
* @param s the string to parse.
*
* @return <code>-1</code> if none of the characters was found, the
* index of the first occurrence otherwise.
*/
/**
* Finds the first occurrence of ' ', '-', ',' or '.'
*
* @param s the string to parse.
*
* @return <code>-1</code> if none of the characters where found, the
* position of the first occurence otherwise.
*/
private static int findSeparator(String s) {
int result = s.indexOf('-');
if (result == -1) {
result = s.indexOf(',');
}
if (result == -1) {
result = s.indexOf(' ');
}
if (result == -1) {
result = s.indexOf('.');
}
return result;
}
/**
* Creates a year from a string, or returns null (format exceptions
* suppressed).
*
* @param s string to parse.
*
* @return <code>null</code> if the string is not parseable, the year
* otherwise.
*/
/**
* Creates a year from a string, or returns null (format exceptions
* suppressed).
*
* @param s the string to parse.
*
* @return <code>null</code> if the string is not parseable, the year
* otherwise.
*/
private static Year evaluateAsYear(String s) {
Year result = null;
try {
result = Year.parseYear(s);
}
catch (TimePeriodFormatException
e) {
// suppress
}
return result;
}
|