9 lines
254 B
TypeScript
Raw Normal View History

2022-12-16 13:52:54 +01:00
export function formatString(text: string, params: string[]): string {
let textWithParams = text;
for (let i = 0; i < params.length; i++) {
textWithParams = textWithParams.replace(`{${i}}`, params[i]);
}
return textWithParams;
}