首页 > 其他 > 详细

求某个字符在字符串中的第5个位置

时间:2016-01-11 18:12:47      阅读:153      评论:0      收藏:0      [点我收藏+]
String ss="2222222222";
Matcher slashMatcher1 = Pattern.compile("2").matcher(ss); int mIdx1 = 0; while (slashMatcher1.find()) { mIdx1++; if (mIdx1 == 5) { break; } } int a = slashMatcher1.start();//a就是第5个2的位置了

 

求某个字符在字符串中的第5个位置

原文:http://www.cnblogs.com/mcahkf/p/5121974.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!