javascript - Equivalent of String.format in jQuery -


I'm trying to move some javascript code from MicrosoftAjax to JQuery. I use Microsoft's JavaScript counterparts in popular NET methods, e.g. String.format (), String.startsWith (), etc. Do they have similarity in jQuery?

For your reference, so that you can choose through it and include those parts Want to continue to use it in a different JS file. Or, you can port them on jQuery.

Here is the format function ...

  string.format = function () {var s = arguments [0]; For (var i = 0; i & lt; arguments.length - 1; i ++) {var reg = New RegExp ("\\ {+ +" + "\\}", "GM"); S = s.replace (reg, argument [i + 1]); } Return S; }  

and end here and begins with prototype functions ...

  string.prototypeands = function (suffix) {return (this .substr (This.length - suffix.length) === suffix); } String.prototype.startsWith = function (prefix) {return (this substr (0, prefix.length) === prefix); }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -