code-problems/problems/string-format at master · smalldatatech/code-problems · GitHub
Skip to content

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.