zoukankan      html  css  js  c++  java
  • 用X++实现有规律分割的长字符串,分别提取(如逗号隔开)

    /***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;

    }

  • 相关阅读:
    MDX示例:求解中位数、四分位数(median、quartile)
    外部网关调用不到server端
    postgreSQL alter column data type to timestamp without time zone
    pgsql数据库创建序列
    Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:repackage failed: Unable to find main class -> [Help 1]
    微服务理论一
    使用svn提交本地任何位置的一个文件
    You have not concluded your merge. (MERGE_HEAD exists)
    org.springframework.web.bind.MissingPathVariableException: Missing URI template variable 'productCode' for method parameter of type String
    栏位索引超过许可范围:1,栏位数:0。; nested exception is org.postgresql.util.PSQLException: 栏位索引超过许可范围:1,栏位数:0。
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2761530.html
Copyright © 2011-2022 走看看