I'm currently having trouble to replace all occurrences of 'x' in my string to a number.
I already tried: myString.replace('x',Integer.toString(i)) and stuff like that with "x", and instead of the Integer to string, replacing a number in quote, and it don't work, the string remains the same.
then I made the following function:
public static void trocaXporDouble(String a, double c){
int i;
for(i=0;i<a.length();i++){
if(a.charAt(i)=='x'){
String newStr1 = a.substring(0,i-1);
String newStr = a.substring(i+1,a.length());
newStr1.concat(Double.toString(c));
newStr1.concat(newStr);
}
}
}
but even with that function it is still not working, can someone give me a hand here?
Thanks in advance.