String s = "[clientname: wangzhen][method: abcd]";String news = s.substring(s.indexOf("method")+ "method: ".length(), s.indexOf("]", s.indexOf("method")) );System.out.println(s); 输出: abcd 此处使用了public int indexOf(String str, int fromIndex)