Reply to comment

La même sous forme de méthode

Un peu plus fun :

String.prototype.trim = function(){
return this.replace(/^\s+/, "").replace(/\s+$/, "");
}

Permet d'écrire :
ma_string.trim()

Alain

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>. The supported tag styles are: <foo>, [foo].

More information about formatting options