• swift 批量 取出中间文本


        func stringmid_pl (wholestring:String,front:String,behind:String,inout return_string:String,getheroid:Bool)

            

        {

            //数组参数inout

           

            // var whole_tmp:String = wholestring

            

     

            

            if wholestring.isEmpty

            {

               // return(return_string) //wholestring 不能为nil

                

            }else  {

                

                var whole:NSString=wholestring

                var whole_tmp = whole

               

                

                let frontindex = whole.rangeOfString(front)

                if frontindex.length > 0

                {

                    whole = whole.substringFromIndex(frontindex.location + frontindex.length)

                    let behindindex = whole.rangeOfString(behind)

                    if behindindex.length > 0

                    {

                        whole = whole.substringToIndex(behindindex.location)

                        

                        return_string = return_string + (whole as String) + ","

                        

    //                  whole_tmp = whole_tmp.stringByReplacingOccurrencesOfString(front, withString: "", options: NSStringCompareOptions.LiteralSearch, range: frontindex)

    //                    

    //                  whole_tmp = whole_tmp.stringByReplacingOccurrencesOfString(behind, withString: "", options: NSStringCompareOptions.LiteralSearch, range: whole_tmp.rangeOfString(behind))

                        

                        

                      whole_tmp = whole_tmp.stringByReplacingOccurrencesOfString(front + (whole as String) + behind, withString: "")

                     if getheroid == true

                     {

                        whole_tmp = whole_tmp.stringByReplacingOccurrencesOfString(front + (whole as String), withString: "")

                        }

                    

                        

                    stringmid_pl(whole_tmp as String, front: front, behind: behind, return_string: &return_string,getheroid:getheroid)

                        

                        

                       // return(whole as String)

                        

                    } else {

                       // return(return_string)

                    } //没有找到behindwholestring

                    

                    

                } else  {

                    //return(return_string)

                }  // 没有找到front wholestring

            

            

            

            

        

        }

        

        

        

     

     

        

    }

  • 相关阅读:
    使用AD你应该避免的五个错误
    卸载常用组件
    学会批处理,用心学很容易
    VI的用法
    安装Linux版VNC 企业版
    【3】淘宝sdk的下载和安装
    【7】创建一个自己的模板
    【6】网店模板目录及文件介绍
    【11】淘宝sdk的DOM、CSS规范、Widget规范(这个Widget规范差不多就是网页效果)和HTML规范
    【2】认识淘宝sdk模板
  • 原文地址:https://www.cnblogs.com/youyaoqi/p/5486651.html
Copyright © 2020-2023  润新知