Inject parameters in string
Hello to all,
May be it will be usefull for somebody.
Very ofthen I need to construct string values in such a way:
some_value="Bla-bla-bla "+thisapp.somenamespace.somefunction(input.ID)+" sdfgsdf:' "+input.someInt.toString()+...... and so on
And when you need to change text - you waste so many time to find and change all quotes, to close them.
You can use this function to inject parameters in string value like this (f is a name of application with functions)
someValue=f.print("User _1 changed value of City to _2 _3",{zoho.loginuser,input.city,zoho.currentdatetime};
string print(string s, list l)
{
i = 0;
for each li in input.l
{
input.s = (input.s).replaceAll("_" + (i + 1),(input.l.get(i)).toString(),true);
i = (i + 1);
}
return input.s;
}