天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 15|回复: 0

arx 分割字符串的函数

[复制链接]
  • TA的每日心情
    开心
    昨天 15:23
  • 签到天数: 69 天

    [LV.6]常住居民II

    410

    主题

    167

    回帖

    2704

    积分

    管理员

    积分
    2704
    发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
    ///////////////////////////////////////////////////////////////
    //        函 数 名 : DivideString
    //        所属类名 : oxaTestCase
    //        函数功能 : 根据指定字符串为分割符号分割字符串为字符串数组。
    //        返 回 值 : void
    //        参数说明 : CString str   //要分割的字符串
    //                                 CString  devChar , //分割符,可以有多个字符
    //                                CStringArray *  &rtStrings  //分割后的结果存储在字符串数组里
    ///////////////////////////////////////////////////////////////
    void oxaTestCase::DivideString(CString str, CString  devChar ,CStringArray *  &rtStrings)
    {
          
            int devLength= devChar.GetLength();
            int pos=str.Find(devChar);
          
        while (pos!=-1)
            {
                    pos=str.Find(devChar);
                    if ( pos!=-1)
                    {
                            if (pos!=0)
                            {
                                    rtStrings->Add(str.Left(pos));      
                            }
                            //取字符串右侧余下的部分
                            int leftLength=str.GetLength()-devLength-pos;
                            if (leftLength>0) {
                                    str=str.Right(leftLength);
                            }
                            else   //处理最后字符串为分割符的情况
                            {
                                    str="";
                            }      
                    }
        }
            if (str.GetLength()>0)  { rtStrings->Add(str); }      
             
             
    }

     

     

     

     

    arx 分割字符串的函数
    中国膜结构网打造全中国最好的膜结构综合平台 ,统一协调膜结构设计,膜结构施工,膜材采购,膜材定制,膜结构预算全方位服务。 中国空间膜结构协会合作单位。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|

    GMT+8, 2024-7-1 05:44 , Processed in 0.059539 second(s), 23 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表