MCPcopy Index your code
hub / github.com/processing/processing / nextString

Method nextString

core/src/processing/data/JSONTokener.java:250–298  ·  view source on GitHub ↗

Return the characters up to the next close quote character. Backslash processing is done. The formal JSON format does not allow strings in single quotes, but an implementation is allowed to accept them. @param quote The quoting character, either "   (double quote)

(char quote)

Source from the content-addressed store, hash-verified

248 * @throws JSONException Unterminated string.
249 */
250 public String nextString(char quote) {
251 char c;
252 StringBuilder sb = new StringBuilder();
253 for (;;) {
254 c = this.next();
255 switch (c) {
256 case 0:
257 case '\n':
258 case '\r':
259 throw new RuntimeException("Unterminated string");
260 case '\\':
261 c = this.next();
262 switch (c) {
263 case 'b':
264 sb.append('\b');
265 break;
266 case 't':
267 sb.append('\t');
268 break;
269 case 'n':
270 sb.append('\n');
271 break;
272 case 'f':
273 sb.append('\f');
274 break;
275 case 'r':
276 sb.append('\r');
277 break;
278 case 'u':
279 sb.append((char)Integer.parseInt(this.next(4), 16));
280 break;
281 case '"':
282 case '\'':
283 case '\\':
284 case '/':
285 sb.append(c);
286 break;
287 default:
288 throw new RuntimeException("Illegal escape.");
289 }
290 break;
291 default:
292 if (c == quote) {
293 return sb.toString();
294 }
295 sb.append(c);
296 }
297 }
298 }
299
300
301 /**

Callers 1

nextValueMethod · 0.95

Calls 4

nextMethod · 0.95
parseIntMethod · 0.80
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected