On Oct 1, 2009, at 5:34 PM, waseem sabjee wrote:

heres an interesting way of doing

var x = mystring.length;
for(x; x > 0; x--) {
 var s = mystring[x];
// if this character is an instance of the character you want to replace
if(mystring.match(/[]/)
 // replace it
 mystring.replace(/[]/, "replacement");
}

It might be interesting, but it seems like a lot of extra work. This can be done with a simple regex replace, as someone already mentioned:

var newString = $.SortSerialize('MDEExportedList').hash.replace(/\[|\]/ g,'');

Not sure what $.SortSerialize('MDEExportedList').hash is all about, but the replace() function should work.


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to