replaceContent function
Implementation
String replaceContent(String content,List<Object> params){
int matchIndex = 0;
String replace(Match m){
if (matchIndex < params.length) {
switch (m[0]){
case "%s":
return params[matchIndex++].toString();
}
}else{
throw new Exception("Missing parameter for string format");
}
throw new Exception("Invalid format string" + m[0].toString());
}
return content.replaceAllMapped('%s', replace);
}