我想通過首先將它拆分成由';'分割的部分來分解此字符串。然後我想將這些部分拆分爲','。它不工作,但我即將打破我的電腦。有人可以幫我解決這個問題。用javascript分割字符串2次
,如果你願意,你可以玩弄我的jsfiddle ... http://jsfiddle.net/ChaZz/
var myString = "Call 1-877-968-7762 to initiate your leave.,-30,0,through;You are eligible to receive 50% pay.,0,365,through;Your leave will be unpaid.,365,0,After;";
var mySplitResult = myString.split(";");
for(i = 0; i < mySplitResult.length -1; i++){
var mySplitResult2 = i.split(",");
for(z = 0; z < mySplitResult2.length -1; i++) {
//document.write("<br /> Element " + i + " = " + mySplitResult[i]);
document.write("<br/>Element" + z + " = " + mySplitResult[z]);
}
}
'for(z = 0; z
jbabey