MCPcopy Create free account
hub / github.com/ReadyTalk/avian / parseField

Method parseField

classpath/java/text/SimpleDateFormat.java:89–98  ·  view source on GitHub ↗
(String text, int offset, int length, Calendar calendar, int field, int adjustment)

Source from the content-addressed store, hash-verified

87 }
88
89 private static int parseField(String text, int offset, int length, Calendar calendar, int field, int adjustment) throws ParseException {
90 if (text.length() < offset + length) throw new ParseException("Short date: " + text, offset);
91 try {
92 int value = Integer.parseInt(text.substring(offset, offset + length), 10);
93 calendar.set(field, value + adjustment);
94 } catch (NumberFormatException e) {
95 throw new ParseException("Not a number: " + text, offset);
96 }
97 return offset + length;
98 }
99
100 private static int expectPrefix(String text, int offset, String prefix) throws ParseException {
101 if (text.length() <= offset) throw new ParseException("Short date: " + text, offset);

Callers 1

parseMethod · 0.95

Calls 4

parseIntMethod · 0.95
lengthMethod · 0.65
setMethod · 0.65
substringMethod · 0.45

Tested by

no test coverage detected