In a precise field, replace two words with another two words.
Example: Sr (a) v1, the value of your invoice is v2 real.
How to get:
Mr Joao , your invoice amount is 10,00 .
So, I have the following method below.
String mensagemI = txtMensagem.getText();
String var1 = txtVariavel1.getText();
String var2 = txtVariavel2.getText();
String var3 = txtVariavel3.getText();
String mensagemF = mensagemI.replaceAll("v1", var1);
System.out.println(mensagemF);
But this way, I can change only one word of the phrase, in this case v1.
Is there another method where I can change two words in a single sentence?
Thank you.