lang/string.js
/**
		 * Performs a simple token replacement on a string; where the tokens
		 * are braced numbers (e.g. {0}, {1}, {2}).
		 *
		 * @public
		 * @static
		 * @param {String} s - The string to format (e.g. 'my first name is {0} and my last name is {1}')
		 * @param {Array<String>} data - The replacement data
		 * @returns {String}
		 */
Performs a simple token replacement on a string; where the tokens
are braced numbers .


Performs a simple token replacement on a string ; where the tokens are braced numbers .
format(s, ...data) {
			assert.argumentIsRequired(s, 's', String);
            return s.replace(/{(\d+)}/g, (match, i) => {
            	let replacement;
            	if (i < data.length) {
            		const item = data[i];
            		if (!is.undefined(item) && !is.null(item)) {
			            replacement = item.toString();
		            } else {
			            replacement = match;
		            }
				} else {
		            replacement = match;
				}
				return replacement;
            });
		}
format ( s , ... data ) { assert . argumentIsRequired ( s , 's' , String ) ; return s . replace ( / {(\d+)} / g , ( match , i ) => { let replacement ; if ( i < data . length ) { const item = data [ i ] ; if ( ! is . undefined ( item ) && ! is . null ( item ) ) { replacement = item . toString ( ) ; } else { replacement = match ; } } else { replacement = match ; } return replacement ; } ) ; }
Performs a simple token replacement on a string; where the tokens
 are braced numbers (e.g.
Performs a simple token replacement on a string ; where the tokens are braced numbers ( e . g .