MCPcopy Create free account
hub / github.com/davidgiven/luje / nextToken

Method nextToken

lib/java/util/StringTokenizer.java:245–273  ·  view source on GitHub ↗

Returns the next token in the string as a String. @return next token in the string as a String. @throws NoSuchElementException if no tokens remain.

()

Source from the content-addressed store, hash-verified

243 * if no tokens remain.
244 */
245 public String nextToken() {
246 if (delimiters == null) {
247 throw new NullPointerException();
248 }
249 int i = position;
250 int length = string.length();
251
252 if (i < length) {
253 if (returnDelimiters) {
254 if (delimiters.indexOf(string.charAt(position), 0) >= 0)
255 return String.valueOf(string.charAt(position++));
256 for (position++; position < length; position++)
257 if (delimiters.indexOf(string.charAt(position), 0) >= 0)
258 return string.substring(i, position);
259 return string.substring(i);
260 }
261
262 while (i < length && delimiters.indexOf(string.charAt(i), 0) >= 0)
263 i++;
264 position = i;
265 if (i < length) {
266 for (position++; position < length; position++)
267 if (delimiters.indexOf(string.charAt(position), 0) >= 0)
268 return string.substring(i, position);
269 return string.substring(i);
270 }
271 }
272 throw new NoSuchElementException();
273 }
274
275 /**
276 * Returns the next token in the string as a {@code String}. The delimiters

Callers 2

isValidDomainNameMethod · 0.95
nextElementMethod · 0.95

Calls 5

valueOfMethod · 0.95
lengthMethod · 0.65
indexOfMethod · 0.65
charAtMethod · 0.65
substringMethod · 0.45

Tested by

no test coverage detected