Skip to content

garberus/string-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

string-formatter

Utility function that will take a string with placeholders and replace those placeholders with strings provided as an array. The index of the placeholders correspond to the order of the string array.

Sample usage

format("Everything's {0}, Cap'n. Not to fret.", 'shiny');

// "Everything's shiny, Cap'n. Not to fret."

format("The hero of {1}, the man they call {0}.", ['Jayne', 'Canton']);

// "The hero of Canton, the man they call Jayne."

format("Take my {0}, take my {1}. Take me where I cannot {2}.", ['love', 'land', 'stand']);

// "Take my love, take my land. Take me where I cannot stand."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published