List of utility methods to do String Find
int[] | getSearchTermOccurrences(final String searchTerm, final String content) Searches "searchTerm" in "content" and returns an array of int pairs (index, length) for each occurrence. if (searchTerm == null || searchTerm.length() == 0) { return new int[0]; if (content == null) { throw new IllegalArgumentException("content is null"); final List<Integer> list = new ArrayList<Integer>(); int searchTermLength = searchTerm.length(); ... |
int | indexOfOccurance(String s1, String s2, Integer i) Index of occurance. ArrayList<Integer> al = new ArrayList<Integer>(); al.addAll(allIndexOf(s1, s2)); if (al.size() <= i - 1) { return al.get(i - i); } else { return -1; |
List | multiFindBetween(String source, String pre, String post) multi Find Between List<String> result = new ArrayList<String>(); int start = 0; int end = 0; while (start != -1 && end != -1) { start = source.indexOf(pre, end); if (start != -1) { end = source.indexOf(post, start + pre.length()); if (end != -1) ... |