Added setString(int, String) and append(String) to JSONArray

String is one of the core datatypes JSONArray supports.
This commit is contained in:
Frank Leon Rose
2013-05-02 12:15:17 -04:00
parent 1d2ff85a52
commit 5988df03fb

View File

@@ -619,6 +619,18 @@ public class JSONArray {
// }
/**
* Append an String value. This increases the array's length by one.
*
* @param value A String value.
* @return this.
*/
public JSONArray append(String value) {
this.append((Object)value);
return this;
}
/**
* Append an int value. This increases the array's length by one.
*
@@ -762,6 +774,21 @@ public class JSONArray {
}
/**
* Put or replace a String value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad
* it out.
* @param index The subscript.
* @param value A String value.
* @return this.
* @throws JSONException If the index is negative.
*/
public JSONArray setString(int index, String value) {
this.set(index, value);
return this;
}
/**
* Put or replace a long value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad