Returns a new string by alternating this array's values with separator. This array's string values are quoted and have their special characters escaped. For example, the array containing the strings '12" pizza', 'taco' and 'soda' joined on '+' returns this: "12\" pizza"+"taco"+"soda"</p
(String separator)
| 553 | * <pre>"12\" pizza"+"taco"+"soda"</pre> |
| 554 | */ |
| 555 | public String join(String separator) throws JSONException { |
| 556 | JSONStringer stringer = new JSONStringer(); |
| 557 | stringer.open(JSONStringer.Scope.NULL, ""); |
| 558 | for (int i = 0, size = values.size(); i < size; i++) { |
| 559 | if (i > 0) { |
| 560 | stringer.out.append(separator); |
| 561 | } |
| 562 | stringer.value(values.get(i)); |
| 563 | } |
| 564 | stringer.close(JSONStringer.Scope.NULL, JSONStringer.Scope.NULL, ""); |
| 565 | return stringer.out.toString(); |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * Encodes this array as a compact JSON string, such as: |