/**
* 获取目标字符串在字符串中第N次出现的位置
* @file name
* @author xiehongwei
* @date 2017-8-2 下午3:29:09
* @param source 源字符串
* @param target 目标字符串
* @param n 出现位置
* @return
*/
public static int getCharacterPosition(String source, String target, int n) {
// 这里是获取目标符号的位置
Matcher slashMatcher = Pattern.compile(target).matcher(source);
int mIdx = 0;
while (slashMatcher.find()) {
mIdx++;
// 当目标符号第N次出现的位置
if (mIdx == n) {
break;
}
}
return slashMatcher.start();
}

最新文章

  1. [LeetCode] Kth Largest Element in an Array 数组中第k大的数字
  2. bzoj 1606: [Usaco2008 Dec]Hay For Sale 购买干草
  3. WebRTC代码走读(十):rtp_rtcp模块分析,webrtcrtp_rtcp
  4. selenium如何分别启动IE、firefox、chrome浏览器
  5. sed 详解
  6. Python数据结构————二叉查找树的实现
  7. android自定义View之NotePad出鞘记
  8. NOIP2014-普及组复赛-第三题-螺旋矩阵
  9. 软件测试:lab1.Junit and Eclemma
  10. 使用 nodeJs 开发微信公众号(配置服务器)
  11. jmeter接口测试实例6-注册(参数化)
  12. 织梦dedecms搜索页加上序列号autoindex
  13. CF359B Permutation (构造)
  14. 其它终端设备连接gmail账户提示密码错误解决方法
  15. bzoj1008
  16. jQuery实现页面关键词高亮
  17. HDUOJ--8球胜负
  18. Redis总结(七)Redis运维常用命令(转载)
  19. Eclipse 工具栏无法移动的解决办法
  20. [android] 切换界面的问题

热门文章

  1. form表单jquery提交400错误
  2. crontab定时任务打包备份文件并删除过期文件
  3. 04 部署uwsgi web服务器
  4. PolandBall and Forest
  5. 增删改查-删除(php)
  6. Suggestions On Setting LED Holiday Light
  7. Echarts--来自官网
  8. Linux_oracle 数据库监听
  9. Android 开发 ThreadPool(线程池) 总结
  10. C short类型的内存分析