Here you can find the source of substringBetween(String str, String tag)
public static String substringBetween(String str, String tag)
//package com.java2s; //License from project: Apache License public class Main { public static String substringBetween(String str, String tag) { return substringBetween(str, tag, tag); }/* w w w .j a v a2s. c om*/ public static String substringBetween(String str, String open, String close) { if ((str == null) || (open == null) || (close == null)) { return null; } int start = str.indexOf(open); if (start != -1) { int end = str.indexOf(close, start + open.length()); if (end != -1) { return str.substring(start + open.length(), end); } } return null; } public static int indexOf(String str, char searchChar) { if (isEmpty(str)) { return -1; } return str.indexOf(searchChar); } public static int indexOf(String str, char searchChar, int startPos) { if (isEmpty(str)) { return -1; } return str.indexOf(searchChar, startPos); } public static int indexOf(String str, String searchStr) { if ((str == null) || (searchStr == null)) { return -1; } return str.indexOf(searchStr); } public static int indexOf(String str, String searchStr, int startPos) { if ((str == null) || (searchStr == null)) { return -1; } if ((searchStr.length() == 0) && (startPos >= str.length())) { return str.length(); } return str.indexOf(searchStr, startPos); } public static String substring(String str, int start) { if (str == null) { return null; } if (start < 0) { start = str.length() + start; } if (start < 0) { start = 0; } if (start > str.length()) { return ""; } return str.substring(start); } public static String substring(String str, int start, int end) { if (str == null) { return null; } if (end < 0) { end = str.length() + end; } if (start < 0) { start = str.length() + start; } if (end > str.length()) { end = str.length(); } if (start > end) { return ""; } if (start < 0) { start = 0; } if (end < 0) { end = 0; } return str.substring(start, end); } public static boolean isEmpty(String str) { return (str == null) || (str.length() == 0); } }