日期:2014-05-16  浏览次数:20401 次

谁能帮我把字符串分割开!谢谢了!
@111|000000000000004|333|666&#dsag$dsa@111111|000000000000004|333333|66666666&#caee$caee

按里面的特殊符号

------解决方案--------------------
split(),应该有优先顺序吧
------解决方案--------------------
L@@K!

It 's Lunch Time, ha!

<script language= "JavaScript ">
<!--
var s = "@111|000000000000004|333|666&#dsag$dsa@111111|000000000000004|333333|66666666&#caee$caee ";
alert(s + "\n " + s.split(/[@|&#$]/));
//-->
</script>

------解决方案--------------------
楼上正解

<script language= "JavaScript ">
var s = "@111|000000000000004|333|666&#dsag$dsa@111111|000000000000004|333333|66666666&#caee$caee ";
var arr = s.split(/[@|&#$]/);
for(i in arr)
{
alert(arr[i]);
}
</script>
------解决方案--------------------
<script language= "JavaScript ">
var s = "@111|000000000000004|333|666&#dsag$dsa@111111|000000000000004|333333|66666666&#caee$caee ";
var arr = s.split(/[@\|&#$]+/);
for(i in arr)
{
alert(arr[i]);
}
</script>