1. java 如何查找匹配的字符和字符串
你可以自己写个方法的!
从返回的第一个位置开始substring,同时记住位置。
public int[] getOffset(String str,String s){
  int[] arr=new int[str.length];
  int j=1;
     while(str.indexOf(s)!=-1){
      int i=str.indexOf(s);
      if(j==1){
       arr[j-1]=i;
      }else{
            arr[j-1]=i+arr[j-2]+1;
            } 
      String st=str.substring(i+1);
      System.out.println(st);
         str=st;
      j++;
      System.out.println("j="+j);
      }
     return arr;
 }
 public static void main(String[] args) {
  String str="abcaabbddab";
  StringText st=new StringText();
  int[] i=st.getOffset(str, "ab");
 for(int j:i){
  System.out.println(j);
 }
 }
2. JAVA中怎样在一个字符串中查找给定的子字符串
调用类java.lang.String
的以下方法都可以:
public int indexOf(String str)
返回指定子字符串在此字符串中第一次出现处的索引。
参数:
str - 任意字符串。 
返回:
如果字符串参数作为一个子字符串在此对象中出现,则返回第一个这种子字符串的第一个字符的索引;如果它不作为一个子字符串出现,则返回 -1。
public int indexOf(String str,int fromIndex)
返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
参数:
str - 要搜索的子字符串。
fromIndex - 开始搜索的索引位置。 
返回:
指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
public int lastIndexOf(String str)
返回指定子字符串在此字符串中最右边出现处的索引。将最右边的空字符串 "" 视为出现在索引值 this.length() 处。
参数:
str - 要搜索的子字符串。 
返回:
如果字符串参数作为一个子字符串在此对象中出现一次或多次,则返回最后一个这种子字符串的第一个字符。如果它不作为一个子字符串出现,则返回 -1。
public int lastIndexOf(String str,int fromIndex)
返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索。
参数:
str - 要搜索的子字符串。
fromIndex - 开始搜索的索引位置。 
返回:
指定子字符串在此字符串中最后一次出现处的索引。
3. java 怎么获得字符串中某一字符的位置
在java中使用indexOf方法即可获得字符串中某一字符的位置,例如Stringstr="abcdef",System.out.println(str.indexOf("c"))。
4. JAVA中如何查找字符串
问题很简单:
1.首先,你的数据源是数组,那么要想对每一个值作操作,必须遍历,所以就有如下代码:
for(int i=0;i<A.length;i++){
    ...
}
2.在循环当中,数组中的每一个正在遍历的元素,就是:A[i];
3.String是java的一个字符串处理类,他有一个非常好用的方法就是,
public boolean startsWith(String prefix),测试此字符串是否以指定的前缀开始。 所以:A[i].startsWith("C")如果返回true,那么他就是以C开头的。
4.综上所述,实现很简单,完成代码如下:
public class Test{
    public static void main(String[] args){
        String[] A ={"CSDF","FDS","CFDSA","DFS","FET"};
        for(int i=0;i<A.length;i++){
            if(A[i].startsWith("C")){
                System.out.println(A[i]);
            }
        }
    }
}
总结:
临时写的,代码没有经过测试,但敢保证其正确性的几率很大,祝你成功。
5. Java实现在字符串中查找字符串
把上上面那仁兄的改改,不知合不合适:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Find {
	public static void main(String[] args) {
		String ss = "...qqqq:hello-a;hello-b;hello-c;hello-d,....";
        Matcher matcher = Pattern.compile("(hello-.)").matcher(ss);
        int index = 0;
        while (matcher.find()) {
            index++;
            if (matcher.group(1).equals("hello-c")) {
                break;
            }
        }
        System.out.println(index); 
	}
}