public static String stripSuffix(String name,String suffix,boolean recursiveStrip){
  if (name.length() < 2) {
    return name;
  }
  int suffixStart=name.lastIndexOf(suffix.charAt(0));
  if (suffixStart != -1 && name.regionMatches(suffixStart,suffix,0,name.length() - suffixStart)) {
    name=name.substring(0,suffixStart);
  }
  if (recursiveStrip && name.endsWith(suffix)) {
    return stripSuffix(name,suffix,recursiveStrip);
  }
  return name;
}

public static String stripSuffix ( String name , String suffix , boolean recursiveStrip ) { if ( name . length ( ) < 2 ) { return name ; } int suffixStart = name . lastIndexOf ( suffix . charAt ( 0 ) ) ; if ( suffixStart != - 1 && name . regionMatches ( suffixStart , suffix , 0 , name . length ( ) - suffixStart ) ) { name = name . substring ( 0 , suffixStart ) ; } if ( recursiveStrip && name . endsWith ( suffix ) ) { return stripSuffix ( name , suffix , recursiveStrip ) ; } return name ; }
strip off the end portion of the name . the user might be typing the activity name such that only a portion has been entered so far ( e . g . " mainactivi " ) and we want to chop off that portion too such that we don ' t offer a layout name partially containing the activity suffix ( e . g . " main_activi " ) .
