Skip to content

Commit fe0088f

Browse files
committed
Added setString(int, String) and append(String) to JSONArray
String is one of the core datatypes JSONArray supports.
1 parent abc0199 commit fe0088f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

core/src/processing/data/JSONArray.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,18 @@ public boolean[] getBooleanArray() {
619619
// }
620620

621621

622+
/**
623+
* Append an String value. This increases the array's length by one.
624+
*
625+
* @param value A String value.
626+
* @return this.
627+
*/
628+
public JSONArray append(String value) {
629+
this.append((Object)value);
630+
return this;
631+
}
632+
633+
622634
/**
623635
* Append an int value. This increases the array's length by one.
624636
*
@@ -762,6 +774,21 @@ public JSONArray setInt(int index, int value) {
762774
}
763775

764776

777+
/**
778+
* Put or replace a String value. If the index is greater than the length of
779+
* the JSONArray, then null elements will be added as necessary to pad
780+
* it out.
781+
* @param index The subscript.
782+
* @param value A String value.
783+
* @return this.
784+
* @throws JSONException If the index is negative.
785+
*/
786+
public JSONArray setString(int index, String value) {
787+
this.set(index, value);
788+
return this;
789+
}
790+
791+
765792
/**
766793
* Put or replace a long value. If the index is greater than the length of
767794
* the JSONArray, then null elements will be added as necessary to pad

0 commit comments

Comments
 (0)