I solved it like this;
1.Created a function
export function FormatString(str: string, ...val: string[]) {
for (let index = 0; index < val.length; index++) {
str = str.replace(`{${index}}`, val[index]);
}
return str;
}
2.Used it like the following;
FormatString("{0} is {1} {2}", "This", "formatting", "hack");