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. Python for loop and while loop

    #!pyton2 #-*- coding:utf-8 -*- for letter in "Python": print "Current letter is:" ...

  2. Node.js网络编程

    Node.js为javascript语言提供了一个在服务端运行的平台,它以其事件驱动,非阻塞I/O机制使得它本身非常适合开发运行在在分布式设备上的I/O密集型应用,分布式应用要求Node.js必须对网 ...

  3. NetCFSvcUtil.exe and Windows 7

    NetCFSvcUtil.exe is the analogous of Svcutil.exe but for devices. You can use it to generate a WCF c ...

  4. 【python】类的访问限制

    在Class内部,可以有属性和方法,而外部代码可以通过直接调用实例变量的方法来操作数据,这样,就隐藏了内部的复杂逻辑. 但是,从前面Student类的定义来看,外部代码还是可以自由地修改一个实例的na ...

  5. HTML5外包

    北京动点飞扬软件 从事html5外包业务五年,是国内第一家以HTML5移动平台.手机平台项目外包业务为主的正规软件团队, 欢迎联系 QQ:372900288 电话:13911652504 我们现已发展 ...

  6. Apache Shiro 使用手册(一)Shiro架构介绍

    一.什么是Shiro Apache Shiro是一个强大易用的Java安全框架,提供了认证.授权.加密和会话管理等功能:  认证 - 用户身份识别,常被称为用户"登录": 授权 - ...

  7. 使用Python xlwt写excel文件

    如果需要使用Python写Excel文件,首先下载或者安装xlwt. pip install xlwt 下面的这些demo应该可以帮助开发者快速上手使用xlwt写Excel文件: 创建工作簿(work ...

  8. MVC4.0网站发布和部署到IIS7.0上的方法

    最近在研究MVC4,使用vs2010,开发的站点在发布和部署到iis7上的过程中遇到了很多问题,现在将解决的过程记录下来,以便日后参考,整个过程主要以截图形式呈现 vs2010的安装和mvc4的安装不 ...

  9. RPM方式安装MySQL5.6和windows下安装mysql解压版

    下载地址: http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpmhttp://cdn.mysql.c ...

  10. [ActionScript 3.0] AS3.0 让一个视频无缝循环播放的一个偏方

    一个视频要循环播放,通常的办法都是播放完后再重新播放,但是不可避免的播放结束和重新开始播放这个时间点上会有停顿,如何解决这个问题,说个偏方吧! package com.views { import f ...