Thanks for all replies.
i use replace(new RegExp(".\]","g") to get it work.
Thanks.
On Fri, Oct 2, 2009 at 10:31 AM, Karl Swedberg <karl@englishrules.com> wrote:
On Oct 1, 2009, at 5:34 PM, waseem sabjee wrote:
heres an interesting way of doingvar x = mystring.length;for(x; x > 0; x--) {var s = mystring[x];// if this character is an instance of the character you want to replaceif(mystring.match(/[]/)// replace itmystring.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
No comments:
Post a Comment