//字符串的Iterator函數
//例子:
//var it=new StringIterator("a,b,c,d",",");
//while(it.hasNext()){
//? alert(it.next());
//}
?1function?StringIterator(aStr,aSep){
?2??this.origin=aStr;
?3??this.sep=aSep;
?4??this.remain=aStr;
?5??this.nextStr=null;
?6??this.hasNext=hasNext;
?7??function?hasNext()?{
?8???var?iIndex=0;
?9???if(this.remain==null){this.remain='';}
10???if(this.remain==''){
11?????this.nextStr=null;
12?????return?false;
13???}

14???iIndex=this.remain.indexOf(aSep);
15???if(iIndex<0){
16?????this.nextStr=this.remain;
17?????this.remain='';
18???}
else{
19?????this.nextStr=this.remain.substring(0,iIndex);
20?????this.remain=this.remain.substring(iIndex+this.sep.length);
21???}

22???return?true;
23??}

24??this.next=next;
25??function?next()?{
26???var?strRtn=this.nextStr;
27???this.nextStr=null;
28???return?strRtn;
29??}

30}

31