If I have the next string template:
String test_template = "\"%1$s\" (%2$s) (%3$s)";
Is there any way I can format it with 3rd parameter only?
MessageFormat.format(test_template, *here put only 3rd parameter*);
If I have the next string template:
String test_template = "\"%1$s\" (%2$s) (%3$s)";
Is there any way I can format it with 3rd parameter only?
MessageFormat.format(test_template, *here put only 3rd parameter*);
You could try:
String test_template2 = "{0} {1} {2}";
System.out.println(MessageFormat.format(test_template2,"first","second", "third"));
System.out.println(MessageFormat.format(test_template2,"","", "third"));
The output will be:
"first second third"
" third"
Hope helped you!
If you want to use named placeholder you can read about how here