private boolean containsClass(String elementClass,String selectorClass){
  if ((elementClass == null) || (selectorClass == null)) {
    return false;
  }
  elementClass=" " + elementClass + " ";
  int dotIndex=selectorClass.indexOf('.');
  while (dotIndex != -1) {
    String curWord=selectorClass.substring(0,dotIndex);
    if (elementClass.indexOf(" " + curWord + " ") == -1) {
      return false;
    }
    selectorClass=selectorClass.substring(dotIndex + 1);
    dotIndex=selectorClass.indexOf('.');
  }
  return (elementClass.indexOf(" " + selectorClass + " ") != -1);
}

private boolean containsClass ( String elementClass , String selectorClass ) { if ( ( elementClass == null ) || ( selectorClass == null ) ) { return false ; } elementClass = " " + elementClass + " " ; int dotIndex = selectorClass . indexOf ( '.' ) ; while ( dotIndex != - 1 ) { String curWord = selectorClass . substring ( 0 , dotIndex ) ; if ( elementClass . indexOf ( " " + curWord + " " ) == - 1 ) { return false ; } selectorClass = selectorClass . substring ( dotIndex + 1 ) ; dotIndex = selectorClass . indexOf ( '.' ) ; } return ( elementClass . indexOf ( " " + selectorClass + " " ) != - 1 ) ; }
checks if the specified class is contained in the specified text this is used for elements that have several classes i . e . class = " class1 class2 " note : a simple indexof could not be used since we need to find whole words and not frgaments of words
