Here you can find the source of getIndexOfChar(String str, String start, String end)
public static List<Integer> getIndexOfChar(String str, String start, String end)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static List<Integer> getIndexOfChar(String str, String start, String end) { int starIndex = 0; List<Integer> list = new ArrayList<Integer>(); while (true) { int a = 0; if (list.size() % 2 == 0) { a = str.indexOf(start, starIndex); } else { a = str.indexOf(end, starIndex); }//from w w w.ja v a 2s . co m if (a == -1) { break; } list.add(a); starIndex = a + 1; } return list; } }