MCPcopy Create free account
hub / github.com/VolmitSoftware/Adapt / join

Method join

src/main/java/com/volmit/adapt/util/JSONArray.java:381–392  ·  view source on GitHub ↗

Make a string from the contents of this JSONArray. The separator string is inserted between each element. Warning: This method assumes that the data structure is acyclical. @param separator A string that will be inserted between the elements. @return a string. @throws JSONException If

(String separator)

Source from the content-addressed store, hash-verified

379 * @throws JSONException If the array contains an invalid number.
380 */
381 public String join(String separator) throws JSONException {
382 int len = this.length();
383 StringBuilder sb = new StringBuilder();
384
385 for (int i = 0; i < len; i += 1) {
386 if (i > 0) {
387 sb.append(separator);
388 }
389 sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
390 }
391 return sb.toString();
392 }
393
394 /**
395 * Get the number of elements in the JSONArray, included nulls.

Callers 1

getAuthorMethod · 0.45

Calls 5

lengthMethod · 0.95
valueToStringMethod · 0.95
getMethod · 0.65
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected