Skip to content

Commit 5ec4cdc

Browse files
authored
Merge pull request #692 from WillRabalais04/bugfixes
Bugfix for Issue #606
2 parents 80a5b12 + 9489ad8 commit 5ec4cdc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

java/src/processing/mode/java/debug/VariableNode.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ public String getStringValue() {
9595
} else if (getType() == TYPE_ARRAY) {
9696
//instance of int[5] (id=998) --> instance of int[5]
9797
str = value.toString().substring(0, value.toString().lastIndexOf(" "));
98+
/*
99+
*formats multidimensional array values to have the size of the first array in
100+
*the first bracket eg.int[][5]-->int[5][]
101+
*/
102+
// resolves issue #606: https://github.com/processing/processing4/issues/606
103+
if (str.contains("][")) {
104+
String brackets = str.substring(str.indexOf('['));
105+
int arrayDimensions = 0;
106+
String num = brackets.replaceAll("[^\\d]", "");
107+
arrayDimensions = (brackets.length() - num.length()) / 2;
108+
brackets = "[" + num + "]" + "[]".repeat(arrayDimensions - 1);
109+
str = str.substring(0, str.indexOf('[')) + brackets;
110+
}
98111
} else if (getType() == TYPE_STRING) {
99112
str = ((StringReference) value).value(); // use original string value (without quotes)
100113
} else {

0 commit comments

Comments
 (0)