Android 高逼格截取字符串

转载请注明出处
http://blog.csdn.net/u014513456/article/details/53728662
[email protected]

待截取的字符串
String str1 =
 "<a href='http://write.blog.csdn.net/mdeditor/1232'>32</a>"
截取完的字符串
String trueStr = ""; 
以上字符串够复杂了吧
我们需要截取1232 这个字符串

校验字符串空和异常处理自己做,直接上干货
Pattern p = Pattern.compile("mdeditor/(.*)'>");
            Matcher m = p.matcher(errorListingId);
            while (m.find()) {
                trueStr = m.group(1);
            }

感觉逼格很高。。。。

猜你喜欢

转载自blog.csdn.net/u014513456/article/details/53728662
今日推荐