public static int[] parseTime(String s) {
if (s != null) {
Pattern p = Pattern.compile("([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])");
Matcher m = p.matcher(s);
if (m.matches()) {
return new int[] {Integer.valueOf(m.group(1)),Integer.valueOf(m.group(2)),Integer.valueOf(m.group(3))};
}
throw new IllegalArgumentException();
Sign in to make a reply
用户6556269531
public static int[] parseTime(String s) {
if (s != null) {
Pattern p = Pattern.compile("([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])");
Matcher m = p.matcher(s);
if (m.matches()) {
return new int[] {Integer.valueOf(m.group(1)),Integer.valueOf(m.group(2)),Integer.valueOf(m.group(3))};
}
}
throw new IllegalArgumentException();
}