I need help to write a method which will do some kind of string formatting. I have list of ids of an object. It may be any object.Like this:
List<Id> listContactIds = [select id from contact limit 5];
And I have a certain string format like this:
String format = "{name} belongs to {Account.Name}";
I need to call a method. Suppose the method name is formatString
.
formatString(listContacts, format);
The method should be able to return list of formatted strings.
We can take the exact field names enclosed in {}
from the format
string.
How to acheive this?