我尝试用浮点值替换表达式中的字符。在第一种情况下一切正常,在第二种情况下没有任何反应。这是我的代码:
expr = expressions.get(i)[0];
for (int j = 0; j < valsListArray.length; j++) {
String selection = (String) valsListArray[j].getSelectedItem();
Float valueFloat = segmentAreas.get(j);
String valueString = "" + valueFloat;
expr = expr.replace(selection, valueString);
}
for (int jj = 0; jj < koefsLabelsArray.size(); jj++) {
String selection1 = (String) koefsLabelsArray.get(jj).getText();
String valueString1 = valsOfKoefs.get(jj).getText();
expr = expr.replace(selection1, valueString1); //here nothing happens
System.out.println(expr);
}