code-problems/problems/string-format at master · blakeembrey/code-problems · GitHub
Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Latest commit

 

History

History

Folders and files

Readme.md

String Format

Create a string formatting function that accepts an input string and a number of arguments to replace positions in the input string.

Example

f('Hello {0} {1}', 'Mr.', 'X') // => 'Hello Mr. X'
f('{1}_{0}', '{1}', '{0}')     // => '{0}_{1}'

By Riga.