Internet Explorer has a broken split function  

I just spent several hours working on an Internet Explorer issue. I seems Internet Explorer does NOT include empty elements in the results of a split. Browser brokeness with relation to the split function is well documented. If you have a string:

var txt = "a|b||c||d|e|f";

that you split on the | character you would expect eight pieces. Internet Explorer will only give you six pieces instead of eight because the 3rd and 5th element is a null string. The problem is compounded if your string starts or ends with a | character.

Note: looks like this is fixed in IE9.

Leave A Reply
All content licensed under the Creative Commons License