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)
| 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. |