/*
__ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
/ _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
| (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
\__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
*/
if (!String.format) {
String.format = function() {
// The string containing the format items (e.g. "{0}") and always has to be the first argument.
var str = arguments[0];
// start with the second argument (i = 1)
for (var i = 1; i < arguments.length; i++) {
// "gm" = RegEx options for Global search (more than one instance) and for Multiline search
var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
str = str.replace(regEx, arguments[i]);
}
return str;
};
}
This function returns a formatted string via parameters. Can be used and outside of the Ascoos Cms.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.