fmt (str, formats) String
deprecatedpublic
Use ES6 template strings instead: http://babeljs.io/docs/learn-es2015/#template-strings
Apply formatting options to the string. This will look for occurrences of "%@" in your string and substitute them with the arguments you pass into this method. If you want to control the specific order of replacement, you can add a number after the key as well to indicate which argument you want to insert.
Ordered insertions are most useful when building loc strings where values you need to insert may appear in different orders.
"Hello %@ %@".fmt('John', 'Doe'); // "Hello John Doe" "Hello %@2, %@1".fmt('John', 'Doe'); // "Hello Doe, John"
Parameters:
-
str
String
- The string to format
-
formats
Array
- An array of parameters to interpolate into string.
Returns:
-
String
- formatted string
Please login to continue.