0 Replies - 1062 Views - Last Post: 25 January 2007 - 06:59 AM

#1 reyco1  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 20-March 05

Search and replace

Posted 25 January 2007 - 06:59 AM

Description: place the prototype on the first frame.Search and replace any word or letter in a string
String.prototype.replace = function(str, rep) {
     return this.split(str).join(rep);
};


//use it like this
var myStr:String = "Hello earth!"
trace(myStr.replace("earth","world")

Is This A Good Question/Topic? 0
  • +

Page 1 of 1