I have a function which currently only accepts two arguments - a string and a List for arguments.
This function goes ahead, gets a string from a language file. In this language file, I wanted to allow a possiblity to add arguments, which would be filled. Example: "{1} has thanked {2}". The function then goes ahead, and using MessageFormat.format adds the arguments to the message.
I've gotten used to other languages (namely SourcePawn) which support the following syntax:
print("%s has thanked %s", user1, user2)
which replaces the %s tags with the arguments, and I wanted to replicate this in Java. Is there any way to do so?
Desired result would be to make the function work like this:
fillInArguments("Hello {1}! You have {2} unread messages!", user.getName(), user.getUnreadMsgs())