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)

} //没有找到behind在wholestring

} else  {

//return(return_string)

}  // 没有找到front 在wholestring

}

}

swift 批量 取出中间文本的更多相关文章

  1. 如何在Word中批量选中特定文本

    如何在Word中批量选中特定文本 举个例子,我们对如下文本进行操作,将文本中所有的“1111111”标红,所有的“2222222”标绿,所有的“3333333”标蓝 在Word中找到“查找”下的“高级 ...

  2. swift 取出中间文本

    func  stringmid (wholestring:String,front:String,behind:String)->String { if wholestring.isEmpty ...

  3. linux下批量查找/替换文本内容

    一般在本地电脑上批量替换文本有许多工具可以做到,比如sublime text ,但大多服务器上都是无图形界面的,为此收集了几条针对linux命令行 实现批量替换文本内容的命令: 1.批量查找某个目下文 ...

  4. Swift - 发送消息(文本,图片,文件等)给微信好友或分享到朋友圈

    通过调用微信提供的API接口,我们可以很方便的在应用中发送消息给微信好友,或者分享到朋友圈.在微信开发平台(https://open.weixin.qq.com)里,提供了详细的说明文档和样例.但由于 ...

  5. zencart批量插入TEXT文本属性attributes

    有时候上传的产品与多级分类比较多,在后台添加文本属性如Name,Number等需要顾客自定义的内容就比较费神了.现在只需将以下代码保存为insert_attributes.php,变量$options ...

  6. 批量查询PDF文本并导出结果的小工具

    效果: 批量查询指定关键字 & 指定目录下PDF文件中的文本,并导出文件路径和关键字所在文本行. 下载: 链接: https://pan.baidu.com/s/1sK2OMMgGX26l7P ...

  7. Swift中的富文本注释格式

    Apple当前启用了Markup语法形式的富文本注释格式,并且为此列出了官方文档,可以参考此链接:https://developer.apple.com/library/ios/documentati ...

  8. iOS(Swift) TextField限制输入文本的长度(不是字数)

    最近做项目有一个特殊需求,就是需要限制一个TextField的输入文本的长度在一定范围内(注意,不是字数),上网查了一圈没有找到类似文章,这里把我的方法写进来,mark一下: 1.对TextField ...

  9. Swift语言 代码添加文本输入框 和 占位文本

    //懒加载文本输入框 private lazy var textView: UITextView = { let textView = UITextView() textView.font = UIF ...

随机推荐

  1. VC2010 MFC中实现printf调试功能,即MFC程序利用控制台输出调试信息。

    1.在项目自动生成的stdafx.h文件中添加下面头文件 #include <io.h> #include <fcntl.h> #include <stdio.h> ...

  2. MFC CPtrLink的使用

    if (!m_SALink.IsEmpty()) { POSITION pos = m_SALink.GetHeadPosition(); for (int j = 0; j < m_SALin ...

  3. 三个loading小动画实例

    直接贴代码: <!DOCTYPE html><html><head>    <meta charset="utf-8">    &l ...

  4. apache-flume-1.5.0-bin windows

    1  testconsole.conf syslog-agent.sources = Syslogsyslog-agent.channels = MemoryChannel-1syslog-agent ...

  5. python pandas.DataFrame选取、修改数据最好用.loc,.iloc,.ix

    先手工生出一个数据框吧 import numpy as np import pandas as pd df = pd.DataFrame(np.arange(0,60,2).reshape(10,3) ...

  6. C#中获取服务器IP,客户端IP以及网卡物理地址

    客户端ip: Request.ServerVariables.Get("Remote_Addr").ToString(); 客户端主机名: Request.ServerVariab ...

  7. python xlwt,xlutils 在excel里面如何插入一行数据

    就是把插入行之后值重新输出来. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 import xl ...

  8. 【uTenux实验】互斥体

    互斥体,维基百科中交互斥锁.其定义是这样的:互斥锁(英语:英语:Mutual exclusion,缩写 Mutex)是一种用于多线程编程中,防止两条线程同时对同一公共资源(比如全局变量)进行读写的机制 ...

  9. JAVA虚拟机类型转换学习

    Java虚拟机包括血多进行基本类型转换工作的操作码,这些执行转换工作的操作码后面没有操作数,转换的值从栈顶端获得.Java虚拟机从栈顶端弹出一个值,对它进行转换,然后再把转换结果压入栈.进行int.l ...

  10. redmine 配置邮件发送为async后,不能发送邮件(转载)

    通过参考:http://www.oschina.net/question/2005703_16688 之前configuration.yaml文件中email的相关配置如下: production: ...