/***用X++实现有规律分割的长字符串,分别提取(如逗号隔开)*/
Job Test
static void xyf_ProcessLongStr_set(Args _args)
{
YAM_ProcessLongStr st = new YAM_ProcessLongStr();
setIterator setIt; //set会自动排序和去除冗余字符串
ListIterator ListIt;//list同理,只是list不会去除字符串冗余和不会自动排序
str s = 'd,te,ut,o,w,q';
; /**
要拆分的分隔符为逗号,即可容许各种有规律的分隔符
默认为","
*/
st.ProcessMulitSet(s,',');
setIt = new setIterator(st.parmSet());
while(setIt.more())
{
print setIt.value();
setIt.next();
}
print st.parmSet().toString();
pause;
}
Class (Function)
class YAM_ProcessLongStr
{
Set _set;
List _list;
}
/**********************************************/
void ProcessMulitList(csm_text _str,
str 10 _flag = ','
)
{
int CountLine=0,long;
CSM_Text _Sid,next_Sid,longIdx;
str DateIdx;
;
_list = new list(types::String);
_Sid = strRem(_str,"/n");
_Sid = strRem(_Sid,"/r");
longIdx = _Sid;
while(StrFind(_Sid,_flag,1,30)!=0)
{
long = strFind(_Sid,_flag,1,30);
DateIdx = substr(_Sid,1,long-1);
_list.addEnd(DateIdx);
next_Sid = substr(_Sid,long+1,strlen(longIdx)-long);
_Sid = strltrim(next_Sid);
long =0;
}
_list.addEnd(_Sid) ;
}
/**********************************************/
void ProcessMulitSet(CSM_text _str ,
str 10 _flag = ','
)
{
int CountLine=0,long;
CSM_Text _Sid,next_Sid,longIdx;
str DateIdx;
;
_set = new set(types::String);
_Sid = strRem(_str,"/n");
_Sid = strRem(_Sid,"/r");
longIdx = _Sid;
while(StrFind(_Sid,_flag,1,30)!=0)
{
long = strFind(_Sid,_flag,1,30);
DateIdx = substr(_Sid,1,long-1);
_set.add(DateIdx);
next_Sid = substr(_Sid,long+1,strlen(longIdx)-long);
_Sid = strltrim(next_Sid);
long =0;
}
_set.add(_Sid) ;
}
/**********************************************/
list parmList()
{
;
return _list;
}
/**********************************************/
set parmSet()
{
;
return _set;
}