public static int count(String string,String mark){
  if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(mark)) {
    int count=0;
    int index=string.indexOf(mark);
    while (index != -1) {
      count++;
      string=string.substring(index + mark.length());
      index=string.indexOf(mark);
    }
    return count;
  }
  return 0;
}

public static int count ( String string , String mark ) { if ( ! TextUtils . isEmpty ( string ) && ! TextUtils . isEmpty ( mark ) ) { int count = 0 ; int index = string . indexOf ( mark ) ; while ( index != - 1 ) { count ++ ; string = string . substring ( index + mark . length ( ) ) ; index = string . indexOf ( mark ) ; } return count ; } return 0 ; }
count how many marks existed in string .
