I have a string called stringexample which I want to split up into an array containing the individual words in the original string. When I try to split it up however it doesn't split as I would like: when the alert comes up, the string has been split as following: [0] = "DATE:", [1] =" 2009/05/03", [2] = "", [3] =" Hello: WORLD".
For some reason "Hello: WORLD" isn't split up into 2 strings.
Why not?
function aftersplit() {
var splitres = Array();
stringexample = "DATE: 2009/05/03 Hello: WORLD"
stringexample = stringexample.split(" ");
for(i = 0; i < stringexample.length; i++){
alert(stringexample);
}
}
Thanks for any help.