/** * 截取两字符之间的字符串,str 和 start不能为null或"" */ public static String getCutOutString(String str, String start, String endwith) { if (TextUtils.isEmpty(str)) { return ""; } String result = ""; if (str.contains(start)) { String s1 = str.split(start)[1]; if (endwith == null || "".equals(endwith)) { result = s1; } else { String s2[] = s1.split(endwith); if (s2 != null) { result = s2[0]; } } } return result; }
截取两个String字符串中间的字符串
最新推荐文章于 2024-07-13 02:38:24 发布