-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add rich Strings.format() #1142
Comments
Original comment posted by ogregoire on 2012-09-10 at 11:37 AM Why does none of these not suit you?
Do you absolutely need named value or is it just needed for inversion? |
Original comment posted by ivan.ivanenko on 2012-09-10 at 01:36 PM The idea is to set key name but not key number in Strings.format() With names key it's look better. Like in Python http://docs.python.org/library/string.html#format-examples Java sample: (maybe you can improve) Strings.format("'Coordinates: {latitude}, {longitude}'", new HashMap<String, Object>() {
|
Original comment posted by ogregoire on 2012-09-10 at 03:02 PM Okay, so that's really a variable interpolation[1] you want. It is used inside Maven and Ant, and Apache Configuration supports it, but doesn't exactly show an isolated way to use it as it is rather integrated. It's indeed not really easy to find such implementation. |
Original comment posted by SeanPFloyd on 2012-09-10 at 03:16 PM So basically what you are looking for is what StrSubstitutor in Apache Commons / Lang does: http://commons.apache.org/lang/api-3.1/org/apache/commons/lang3/text/StrSubstitutor.html |
Original comment posted by kevinb@google.com on 2013-04-08 at 06:58 PM (No comment entered for this change.) Labels: |
Original comment posted by kak@google.com on 2013-08-22 at 10:12 PM At this time, we don't plan to add any templating tools to Guava. Status: |
Original issue created by ivan.ivanenko on 2012-09-10 at 09:53 AM
Strings.format("htpp?value1={VALUE_2}&value2=${VALUE_1}", new HashMap<String, Object>() {
{
put("{VALUE_1}", 123);
put("{VALUE_2}", "321");
}
});
should return "htpp?value1=321,value2=123"
The text was updated successfully, but these errors were encountered: