public static int[] parseTime(String s) { // FIXME: if (s != null) { Pattern pattern = Pattern.compile("(\\d{2})\\:(\\d{2})\\:(\\d{2})"); Matcher matcher = pattern.matcher(s); int a, b, c; if (matcher.matches() && (a = Integer.parseInt(matcher.group(1))) < 24 && (b = Integer.parseInt(matcher.group(2))) < 60 && (c = Integer.parseInt(matcher.group(3))) < 60) { return (new int[] { a, b, c }); } } throw new IllegalArgumentException(); }
Sign in to make a reply
Best of Me