I have something like this:
string text = "user {0} Email is address 1}. " // params = {"Robert", "rhume55@gmail.com"} string msg = message format Format (text, parameter); This is not great for me, because sometimes my translators are not sure which goes in {0} and {1}, it would also be good to send messages to Regardless of the order of the Wrig
I want to change the arguments instead of the numbers rather than the numbers to be called. Something like this:
string text = "user {USERNAME} has email address {EMAILADDRESS}." // map map = new hashmap (... [USERNAME = "Robert", EMAILADDRESS = "rhume55@gmail.com"] String msg = message format.form (text, map); Is there an easy way to do this?
Thanks
See the details here:
string text = "The email address of user {name} is {email}."; Object [] Params Map.put ("name", "robert"); map.put ("email", "map", "map", " System.out.println ("1:" + MapFormat.format (text, map)); Output: 1: User Robert's email address rhume55 @ Gmail is com.
Comments
Post a Comment