I’m having a String like this :
{0}/suhdp run -command "suhilb" -input /sufiles/{1} -output /seismicdata/mr_files/{2}/ -cwproot {3}
The values at the 0th and the 3rd index need to replaced first. Later on, the 1st and 2nd indexes will replaced (on the already partially formatted String) and finally used.
I played around a bit with ChoiceFormat but was not able to pipe it with the MessageFormat class to achieve what I want to.
Any pointers are welcome !
Since you don’t fill all values at once, I’d suggest you use a builder:
This way you can do:
This code probably lacks some error checking etc, and it is far from being optimal, but you get the idea.