private static boolean matches(String arg,String p){
  if (p.endsWith(" ")) {
    return arg.equals(p.substring(0,p.length() - 1)) || arg.startsWith(p);
  }
  if (p.endsWith("$")) {
    return arg.equals(p.substring(0,p.length() - 1));
  }
  return arg.startsWith(p);
}

private static boolean matches ( String arg , String p ) { if ( p . endsWith ( " " ) ) { return arg . equals ( p . substring ( 0 , p . length ( ) - 1 ) ) || arg . startsWith ( p ) ; } if ( p . endsWith ( "$" ) ) { return arg . equals ( p . substring ( 0 , p . length ( ) - 1 ) ) ; } return arg . startsWith ( p ) ; }
does the argument match the prefix ?
