Java: Find word in string and edit words after the word

If you want to edit a value easily based on something else in the program, you can make it so the number is a variable instead. Judging by the code as well, you want there to be a new line, currently it’s not doing that since you need to use "\n"

So the code should look like:

int arrows = 4;

String myString = "Money = 10" + "\n" + "Arrows = " + arrows;

If you then change the value of the integer arrows before declaring the string it will be different.

Leave a Comment