If an object index on a string is actually valid then you can use this:
String.prototype.customSplit = function (x) {
var a,
b,
c = this.length,
d = x.length,
e,
f = [],
g = [];
for (a = 0; a < c; a += 1) {
if (d > 1) {
for (b = a; b < d; b += 1) {
e.push(this[b]);
}
e.join("");
} else {
e = this[a];
}
if (e !== x) {
f.push(this[a]);
} else {
g.push(f.join(""));
f = [];
}
}
for (; a < c; a += 1) {
f.push(this[a]);
}
g.push(f.join(""));
return g;
};
Otherwise, I do not believe there is any valid solution. Personally, I
will continue using the charAt method for the foreseeable future.
Thanks,
Austin Cheney, Travelocity User Experience
CISSP TS/SCI
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]