Kirjaudu
Google-sovellukset
Päävalikko
Post a Comment On:
mo.notono.us
"Simple JavaScript string tokenizer"
No comments yet. -
1 – 0 of 0
A crude String.Format equivalent in JavaScript -blatantly copied from
frogsbrain
//from http://frogsbrain.wordpress.com/2007/04/28/javascript-stringformat-method/ String.format = function(text) { if (arguments.length > 1) { for (var i = 0; i < arguments.length - 1; i++) { text = text.replace(new RegExp("\\{" + i + "\\}", "gi"), arguments[i + 1]); } } return text; };
#twitcode
version (130 characters!) strf=function(t){a=arguments;if(a.length>1)for(i=0;i<a.length-1;i++)t=t.replace(new RegExp("\\{"+i+"\\}","gi"),a[i+1]);return t};
posted by Oskar Austegard at
4:32 PM
on Jun 16, 2009
Leave your comment
You can use some HTML tags, such as
<b>, <i>, <a>
Comments on this blog are restricted to team members.
Google Account
You will be asked to sign in after submitting your comment.
Please prove you're not a robot
"Simple JavaScript string tokenizer"
No comments yet. -