File tree Expand file tree Collapse file tree
java/src/processing/mode/java/debug Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments