This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In my previous life as an object-oriented Pascal programmer for the Macintosh, we learned to internationalize by using full sentences like: "Sorry, you cannot ^1 because ^2". We learned not to use String concatenation, but to use parameter substitution instead. One problem that we solved is that different languages can have different word orders. String concatenation assumes a particular language's word order, whereas parameter substitution works for languages with a different word order.
In Pascal, the code looked like:
string2 := Param4(string1,param1,param2,param3);
In Java should I just use: String.replace(String,String) and call String.replace() once for each parameter?
Is there an easy way to do this with regular expressions or with the Pattern class? With Java 5.0, I could write my own function using varargs to take any number of parameters.
In Unicode is there a better character to indicate parameter substitution than the caret "^"?